Spaces:
Running
Running
Fabrice-TIERCELIN
commited on
Commit
•
03d6362
1
Parent(s):
dd37935
Restore timing
Browse files
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
|
|
|
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
|