Spaces:
Build error
Build error
AlexKoff88
commited on
Commit
·
e9ba573
1
Parent(s):
7e75aa2
Added seed
Browse files
app.py
CHANGED
@@ -28,10 +28,11 @@ pipes = {
|
|
28 |
"OpenVINO merged and quantized": pipe_tome_int8
|
29 |
}
|
30 |
|
31 |
-
def generate(prompt, option):
|
32 |
pipe = pipes[option]
|
|
|
33 |
start_time = time.time()
|
34 |
-
output = pipe(prompt, num_inference_steps=50, output_type="pil")
|
35 |
elapsed_time = time.time() - start_time
|
36 |
return (output.images[0], "{:10.4f}".format(elapsed_time))
|
37 |
|
@@ -45,6 +46,7 @@ gr.Interface(
|
|
45 |
fn=generate,
|
46 |
inputs=[gr.inputs.Textbox(placeholder="cartoon bird", label="Prompt", lines=1),
|
47 |
gr.inputs.Dropdown(choices=model_options, default=model_options[-1], label="Model version"),
|
|
|
48 |
],
|
49 |
outputs=[gr.outputs.Image(type="pil", label="Generated Image"), gr.outputs.Textbox(label="Inference time")],
|
50 |
title="OpenVINO-optimized Stable Diffusion",
|
|
|
28 |
"OpenVINO merged and quantized": pipe_tome_int8
|
29 |
}
|
30 |
|
31 |
+
def generate(prompt, option, seed):
|
32 |
pipe = pipes[option]
|
33 |
+
set_seed(int(seed))
|
34 |
start_time = time.time()
|
35 |
+
output = pipe(prompt, num_inference_steps=50, output_type="pil", height=512, width=512)
|
36 |
elapsed_time = time.time() - start_time
|
37 |
return (output.images[0], "{:10.4f}".format(elapsed_time))
|
38 |
|
|
|
46 |
fn=generate,
|
47 |
inputs=[gr.inputs.Textbox(placeholder="cartoon bird", label="Prompt", lines=1),
|
48 |
gr.inputs.Dropdown(choices=model_options, default=model_options[-1], label="Model version"),
|
49 |
+
gr.inputs.Textbox(placeholder="42", label="Seed", lines=1)
|
50 |
],
|
51 |
outputs=[gr.outputs.Image(type="pil", label="Generated Image"), gr.outputs.Textbox(label="Inference time")],
|
52 |
title="OpenVINO-optimized Stable Diffusion",
|