Spaces:
Runtime error
Runtime error
Mygyasir
commited on
Commit
·
f0aa6da
1
Parent(s):
55bfd26
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from diffusers import DiffusionPipeline
|
| 2 |
+
import torch
|
| 3 |
+
import gradio as gr
|
| 4 |
+
|
| 5 |
+
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, use_safetensors=True, variant="fp16")
|
| 6 |
+
pipe.to("cuda:0")
|
| 7 |
+
|
| 8 |
+
def generate_image(prompt):
|
| 9 |
+
images = pipe(prompt='an highly detailed , highly realistic'+prompt).images[0]
|
| 10 |
+
return images
|
| 11 |
+
|
| 12 |
+
iface = gr.Interface(fn=generate_image, inputs="text", outputs="image")
|
| 13 |
+
iface.launch(share = True)
|