Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import torch
|
3 |
+
# from diffusers import DiffusionPipeline
|
4 |
+
from diffusers import StableDiffusionPipeline
|
5 |
+
|
6 |
+
SAFETENSORS_PATH = "./dreamshaper_5BakedVae.safetensors"
|
7 |
+
|
8 |
+
def generate(prompt):
|
9 |
+
pipeline = StableDiffusionPipeline.from_pretrained(SAFETENSORS_PATH , torch_dtype = torch.float16 , use_safetensors = True)
|
10 |
+
pipeline.to("cuda")
|
11 |
+
return pipeline(prompt).images[0]
|
12 |
+
|
13 |
+
iface = gr.Interface(fn=generate, inputs="text", outputs="image")
|
14 |
+
iface.launch()
|