uripper
commited on
Commit
·
2243ad7
1
Parent(s):
e521b52
updates to interface
Browse files
app.py
CHANGED
|
@@ -1,20 +1,32 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from diffusers import PNDMPipeline, PNDMScheduler
|
| 3 |
|
| 4 |
-
|
| 5 |
-
scheduler = PNDMScheduler(num_train_timesteps=1100)
|
| 6 |
-
pipeline = PNDMPipeline.from_pretrained("uripper/GIANNIS", scheduler=scheduler)
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
def generate_img():
|
| 10 |
try:
|
| 11 |
pipeline.to("cuda")
|
| 12 |
except:
|
| 13 |
pass
|
| 14 |
images= pipeline().images
|
|
|
|
| 15 |
im = images[0]
|
| 16 |
return im
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from diffusers import PNDMPipeline, PNDMScheduler
|
| 3 |
|
| 4 |
+
def update():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
try:
|
| 6 |
pipeline.to("cuda")
|
| 7 |
except:
|
| 8 |
pass
|
| 9 |
images= pipeline().images
|
| 10 |
+
print(images)
|
| 11 |
im = images[0]
|
| 12 |
return im
|
| 13 |
|
| 14 |
+
scheduler = PNDMScheduler(num_train_timesteps=1100)
|
| 15 |
+
pipeline = PNDMPipeline.from_pretrained("uripper/GIANNIS", scheduler=scheduler)
|
| 16 |
+
|
| 17 |
+
css = """
|
| 18 |
+
.container {
|
| 19 |
+
max-width: 512px;
|
| 20 |
+
max-height: 512px;
|
| 21 |
+
margin: auto;
|
| 22 |
+
padding-top: 1.5rem;
|
| 23 |
+
}
|
| 24 |
+
"""
|
| 25 |
+
block = gr.Blocks(css=css)
|
| 26 |
|
| 27 |
+
with block as demo:
|
| 28 |
+
with gr.Row():
|
| 29 |
+
out = gr.Image()
|
| 30 |
+
btn = gr.Button("Generate")
|
| 31 |
+
btn.click(update, inputs=None, outputs=out)
|
| 32 |
+
demo.launch()
|