Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from diffusers import StableDiffusionPipeline
|
3 |
+
import torch
|
4 |
+
|
5 |
+
model_id = "prompthero/openjourney"
|
6 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
7 |
+
pipe = pipe.to("cuda")
|
8 |
+
|
9 |
+
def generate_image(prompt):
|
10 |
+
image = pipe(prompt).images[0]
|
11 |
+
return image
|
12 |
+
|
13 |
+
iface = gr.Interface(generate_image, gr.inputs.Textbox(label="Enter a prompt"), gr.outputs.Image())
|
14 |
+
iface.launch()
|