Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
3 |
import random
|
|
|
4 |
from optimum.intel import OVStableDiffusionXLPipeline
|
5 |
import torch
|
6 |
from diffusers import EulerDiscreteScheduler
|
@@ -69,6 +70,9 @@ def infer(
|
|
69 |
generator=generator,
|
70 |
).images[0]
|
71 |
|
|
|
|
|
|
|
72 |
return image, seed
|
73 |
|
74 |
|
@@ -96,6 +100,7 @@ with gr.Blocks() as img:
|
|
96 |
|
97 |
run_button = gr.Button("Run", scale=0, variant="primary")
|
98 |
|
|
|
99 |
result = gr.Image(label="Result", show_label=False)
|
100 |
|
101 |
with gr.Accordion("Advanced Settings", open=False):
|
@@ -169,7 +174,7 @@ with gr.Blocks() as img:
|
|
169 |
guidance_scale,
|
170 |
num_inference_steps,
|
171 |
],
|
172 |
-
outputs=[result, seed],
|
173 |
)
|
174 |
|
175 |
if __name__ == "__main__":
|
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
3 |
import random
|
4 |
+
import time
|
5 |
from optimum.intel import OVStableDiffusionXLPipeline
|
6 |
import torch
|
7 |
from diffusers import EulerDiscreteScheduler
|
|
|
70 |
generator=generator,
|
71 |
).images[0]
|
72 |
|
73 |
+
filename = f"./tmp/{time.time()}.jpg"
|
74 |
+
image.save(filename)
|
75 |
+
|
76 |
return image, seed
|
77 |
|
78 |
|
|
|
100 |
|
101 |
run_button = gr.Button("Run", scale=0, variant="primary")
|
102 |
|
103 |
+
file_output = gr.File(label="Download your image")
|
104 |
result = gr.Image(label="Result", show_label=False)
|
105 |
|
106 |
with gr.Accordion("Advanced Settings", open=False):
|
|
|
174 |
guidance_scale,
|
175 |
num_inference_steps,
|
176 |
],
|
177 |
+
outputs=[result, seed, file_output],
|
178 |
)
|
179 |
|
180 |
if __name__ == "__main__":
|