Fabrice-TIERCELIN commited on
Commit
4667d53
·
verified ·
1 Parent(s): 4d28740

Time in seconds

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -1,6 +1,7 @@
1
  from diffusers import StableDiffusionXLInpaintPipeline
2
  import gradio as gr
3
  import numpy as np
 
4
  import math
5
  import random
6
  import imageio
@@ -19,6 +20,7 @@ def noise_color(color, noise):
19
  return color + random.randint(- noise, noise)
20
 
21
  def predict(source_img, enlarge_top, enlarge_right, enlarge_bottom, enlarge_left, prompt, negative_prompt, denoising_steps, num_inference_steps, guidance_scale, randomize_seed, seed, debug_mode, progress=gr.Progress()):
 
22
  progress(0, desc = "Preparing data...")
23
 
24
  if source_img is None:
@@ -115,9 +117,10 @@ def predict(source_img, enlarge_top, enlarge_right, enlarge_bottom, enlarge_left
115
  enlarged_image = None
116
  mask_image = None
117
 
 
118
  return [
119
  output_image,
120
- "Start again to get a different result. The new image is " + str(output_width) + " pixels large and " + str(output_height) + " pixels high, so an image of " + str(output_width * output_height) + " pixels." + limitation,
121
  input_image,
122
  enlarged_image,
123
  mask_image
@@ -141,7 +144,7 @@ gr.Interface(fn = predict, inputs = [
141
  gr.Checkbox(label = "Debug mode", value = True, info = "Show intermediate results")
142
  ], outputs = [
143
  gr.Image(label = "Uncropped image"),
144
- gr.Label(),
145
  gr.Image(label = "Original image"),
146
  gr.Image(label = "Enlarged image"),
147
  gr.Image(label = "Mask image")
 
1
  from diffusers import StableDiffusionXLInpaintPipeline
2
  import gradio as gr
3
  import numpy as np
4
+ import time
5
  import math
6
  import random
7
  import imageio
 
20
  return color + random.randint(- noise, noise)
21
 
22
  def predict(source_img, enlarge_top, enlarge_right, enlarge_bottom, enlarge_left, prompt, negative_prompt, denoising_steps, num_inference_steps, guidance_scale, randomize_seed, seed, debug_mode, progress=gr.Progress()):
23
+ start = time.time()
24
  progress(0, desc = "Preparing data...")
25
 
26
  if source_img is None:
 
117
  enlarged_image = None
118
  mask_image = None
119
 
120
+ end = time.time()
121
  return [
122
  output_image,
123
+ "Start again to get a different result. The new image is " + str(output_width) + " pixels large and " + str(output_height) + " pixels high, so an image of " + str(output_width * output_height) + " pixels. The image have been generated in " + str(end - start) + " seconds." + limitation,
124
  input_image,
125
  enlarged_image,
126
  mask_image
 
144
  gr.Checkbox(label = "Debug mode", value = True, info = "Show intermediate results")
145
  ], outputs = [
146
  gr.Image(label = "Uncropped image"),
147
+ gr.Label(label = "Information"),
148
  gr.Image(label = "Original image"),
149
  gr.Image(label = "Enlarged image"),
150
  gr.Image(label = "Mask image")