Spaces:
Runtime error
Runtime error
AbdulRahim07
commited on
Commit
β’
6069e8e
1
Parent(s):
c86620d
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import transformers
|
2 |
+
import gradio as gr
|
3 |
+
from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
|
4 |
+
import torch
|
5 |
+
|
6 |
+
model_id = "stabilityai/stable-diffusion-2"
|
7 |
+
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
|
8 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16)
|
9 |
+
pipe = pipe.to("cuda")
|
10 |
+
|
11 |
+
def imgtext(inp):
|
12 |
+
image = pipe(inp).images[0]
|
13 |
+
return image
|
14 |
+
|
15 |
+
wp=gr.Interface(fn=imgtext,inputs="text",outputs="image")
|
16 |
+
wp.launch()
|