Spaces:
Sleeping
Sleeping
Prgckwb
commited on
Commit
•
e11bea1
1
Parent(s):
2b72305
:memo: Change button location
Browse files
app.py
CHANGED
@@ -5,10 +5,14 @@ from PIL import Image
|
|
5 |
from diffusers import DiffusionPipeline
|
6 |
|
7 |
DIFFUSERS_MODEL_IDS = [
|
|
|
8 |
"stabilityai/stable-diffusion-3-medium-diffusers",
|
9 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
10 |
"stabilityai/stable-diffusion-2-1",
|
11 |
"runwayml/stable-diffusion-v1-5",
|
|
|
|
|
|
|
12 |
]
|
13 |
|
14 |
EXTERNAL_MODEL_MAPPING = {
|
@@ -54,6 +58,9 @@ def inference(
|
|
54 |
except Exception as e:
|
55 |
raise gr.Error(str(e))
|
56 |
|
|
|
|
|
|
|
57 |
image = pipe(
|
58 |
prompt,
|
59 |
negative_prompt=negative_prompt,
|
@@ -95,6 +102,9 @@ if __name__ == "__main__":
|
|
95 |
gr.Image(label="Image", type="pil"),
|
96 |
]
|
97 |
|
|
|
|
|
|
|
98 |
gr.Examples(
|
99 |
examples=[
|
100 |
['stabilityai/stable-diffusion-3-medium-diffusers', 'A cat holding a sign that says Hello world', ""],
|
@@ -104,7 +114,4 @@ if __name__ == "__main__":
|
|
104 |
inputs=inputs,
|
105 |
)
|
106 |
|
107 |
-
btn = gr.Button("Generate")
|
108 |
-
btn.click(fn=inference, inputs=inputs, outputs=outputs)
|
109 |
-
|
110 |
demo.queue().launch()
|
|
|
5 |
from diffusers import DiffusionPipeline
|
6 |
|
7 |
DIFFUSERS_MODEL_IDS = [
|
8 |
+
# SD Models
|
9 |
"stabilityai/stable-diffusion-3-medium-diffusers",
|
10 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
11 |
"stabilityai/stable-diffusion-2-1",
|
12 |
"runwayml/stable-diffusion-v1-5",
|
13 |
+
|
14 |
+
# Other Models
|
15 |
+
"Prgckwb/trpfrog-diffusion",
|
16 |
]
|
17 |
|
18 |
EXTERNAL_MODEL_MAPPING = {
|
|
|
58 |
except Exception as e:
|
59 |
raise gr.Error(str(e))
|
60 |
|
61 |
+
if device != 'cuda':
|
62 |
+
raise gr.Error("This model requires a GPU to run. Please switch to a GPU runtime.")
|
63 |
+
|
64 |
image = pipe(
|
65 |
prompt,
|
66 |
negative_prompt=negative_prompt,
|
|
|
102 |
gr.Image(label="Image", type="pil"),
|
103 |
]
|
104 |
|
105 |
+
btn = gr.Button("Generate")
|
106 |
+
btn.click(fn=inference, inputs=inputs, outputs=outputs)
|
107 |
+
|
108 |
gr.Examples(
|
109 |
examples=[
|
110 |
['stabilityai/stable-diffusion-3-medium-diffusers', 'A cat holding a sign that says Hello world', ""],
|
|
|
114 |
inputs=inputs,
|
115 |
)
|
116 |
|
|
|
|
|
|
|
117 |
demo.queue().launch()
|