sudo-soldier commited on
Commit
189badd
Β·
verified Β·
1 Parent(s): ca51646

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -2,14 +2,14 @@ import gradio as gr
2
  from diffusers import StableDiffusionPipeline
3
  import torch
4
 
5
- # Load model
6
  pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=torch.float32)
7
  pipe.to("cuda" if torch.cuda.is_available() else "cpu")
8
 
9
- # Disable safety checker (optional)
10
  pipe.safety_checker = lambda images, **kwargs: (images, False)
11
 
12
- # Define inference function
13
  def infer(prompt, guidance_scale, num_inference_steps):
14
  with torch.no_grad():
15
  try:
@@ -18,7 +18,7 @@ def infer(prompt, guidance_scale, num_inference_steps):
18
  except Exception as e:
19
  return f"Error: {str(e)}"
20
 
21
- # Gradio UI
22
  with gr.Blocks() as demo:
23
  gr.Markdown("πŸš€ Hyper-Sketch")
24
 
 
2
  from diffusers import StableDiffusionPipeline
3
  import torch
4
 
5
+
6
  pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=torch.float32)
7
  pipe.to("cuda" if torch.cuda.is_available() else "cpu")
8
 
9
+
10
  pipe.safety_checker = lambda images, **kwargs: (images, False)
11
 
12
+
13
  def infer(prompt, guidance_scale, num_inference_steps):
14
  with torch.no_grad():
15
  try:
 
18
  except Exception as e:
19
  return f"Error: {str(e)}"
20
 
21
+
22
  with gr.Blocks() as demo:
23
  gr.Markdown("πŸš€ Hyper-Sketch")
24