Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,16 @@
|
|
1 |
-
from diffusers import StableDiffusionPipeline
|
2 |
import torch
|
|
|
3 |
|
4 |
model_id = "runwayml/stable-diffusion-v1-5"
|
5 |
-
|
6 |
-
pipe = pipe.to("cuda")
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from diffusers import StableDiffusionPipeline as SD
|
2 |
import torch
|
3 |
+
import gradio as gr
|
4 |
|
5 |
model_id = "runwayml/stable-diffusion-v1-5"
|
6 |
+
gen = SD.from_pretrained(model_id)
|
|
|
7 |
|
8 |
+
gen.to("cuda")
|
9 |
+
|
10 |
+
def generate():
|
11 |
+
prompt = "A doggo"
|
12 |
+
image = gen(prompt).images[0]
|
13 |
+
image.save("result.png")
|
14 |
+
|
15 |
+
ui = gr.Interface(fn=generate, inputs="prompt_field", outputs="result")
|
16 |
+
ui.launch()
|