Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,14 +2,14 @@ import gradio as gr
|
|
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,7 +18,7 @@ def infer(prompt, guidance_scale, num_inference_steps):
|
|
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 |
|
|
|
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 |
|