AlexKoff88 commited on
Commit
cdcffe0
·
1 Parent(s): 0ee3f65

Updated time output

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -29,7 +29,7 @@ def generate(image, option):
29
  start_time = time.time()
30
  output = pipe(prompt, num_inference_steps=50, output_type="pil")
31
  elapsed_time = time.time() - start_time
32
- return (output.images[0], f"Inference time: {elapsed_time}")
33
 
34
  examples = ["cartoon bird",
35
  "a drawing of a green pokemon with red eyes",
@@ -40,7 +40,7 @@ gr.Interface(
40
  inputs=[gr.inputs.Textbox(placeholder="cartoon bird", label="Prompt", lines=1),
41
  gr.inputs.Dropdown(choices=[option for option in pipes.keys()], default="Merged and quantized", label="Model version"),
42
  ],
43
- outputs=[gr.outputs.Image(type="pil", label="Generated Image"), "text"],
44
  title="OpenVINO-optimized Stable Diffusion",
45
  description="This is the Optimum-based demo for NNCF-optimized Stable Diffusion pipeline trained on 'lambdalabs/pokemon-blip-captions' dataset and running with OpenVINO.\n"
46
  "The pipeline is run using 8 vCPUs (4 cores) only.",
 
29
  start_time = time.time()
30
  output = pipe(prompt, num_inference_steps=50, output_type="pil")
31
  elapsed_time = time.time() - start_time
32
+ return (output.images[0], "{:10.4f}".format(elapsed_time))
33
 
34
  examples = ["cartoon bird",
35
  "a drawing of a green pokemon with red eyes",
 
40
  inputs=[gr.inputs.Textbox(placeholder="cartoon bird", label="Prompt", lines=1),
41
  gr.inputs.Dropdown(choices=[option for option in pipes.keys()], default="Merged and quantized", label="Model version"),
42
  ],
43
+ outputs=[gr.outputs.Image(type="pil", label="Generated Image"), gr.outputs.Textbox(label="Inference time")],
44
  title="OpenVINO-optimized Stable Diffusion",
45
  description="This is the Optimum-based demo for NNCF-optimized Stable Diffusion pipeline trained on 'lambdalabs/pokemon-blip-captions' dataset and running with OpenVINO.\n"
46
  "The pipeline is run using 8 vCPUs (4 cores) only.",