Spaces:
Running
Running
Fabrice-TIERCELIN
commited on
Preserve original size
Browse files
app.py
CHANGED
@@ -187,14 +187,29 @@ def uncrop(
|
|
187 |
output_width = math.floor(output_width * factor)
|
188 |
output_height = math.floor(output_height * factor)
|
189 |
|
190 |
-
limitation = " Due to technical limitation, the image have been downscaled.";
|
191 |
|
192 |
# Width and height must be multiple of 8
|
193 |
output_width = output_width - (output_width % 8)
|
194 |
output_height = output_height - (output_height % 8)
|
195 |
progress(None, desc = "Processing...")
|
196 |
|
197 |
-
output_image = pipe(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
|
199 |
if debug_mode == False:
|
200 |
input_image = None
|
@@ -225,7 +240,7 @@ with gr.Blocks() as interface:
|
|
225 |
gr.Markdown(
|
226 |
"""
|
227 |
<p style="text-align: center;"><b><big><big><big>Uncrop</big></big></big></b></p>
|
228 |
-
<p style="text-align: center;">Enlarges the point of view of your image,
|
229 |
<br/>
|
230 |
<br/>
|
231 |
🚀 Powered by <i>SDXL 1.0</i> artificial intellingence. For illustration purpose, not information purpose. The new content is not based on real information but imagination.
|
@@ -244,7 +259,6 @@ with gr.Blocks() as interface:
|
|
244 |
<a href='https://huggingface.co/spaces/Fabrice-TIERCELIN/Uncrop?duplicate=true'><img src='https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14'></a>
|
245 |
<br/>
|
246 |
⚖️ You can use, modify and share the generated images but not for commercial uses.
|
247 |
-
|
248 |
"""
|
249 |
)
|
250 |
with gr.Row():
|
@@ -362,12 +376,44 @@ with gr.Blocks() as interface:
|
|
362 |
],
|
363 |
examples = [
|
364 |
[
|
365 |
-
"Example1.
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
"Border, frame, painting, scribbling, smear, noise, blur, watermark",
|
372 |
20,
|
373 |
1000,
|
|
|
187 |
output_width = math.floor(output_width * factor)
|
188 |
output_height = math.floor(output_height * factor)
|
189 |
|
190 |
+
limitation = " Due to technical limitation, the image have been downscaled and then upscaled.";
|
191 |
|
192 |
# Width and height must be multiple of 8
|
193 |
output_width = output_width - (output_width % 8)
|
194 |
output_height = output_height - (output_height % 8)
|
195 |
progress(None, desc = "Processing...")
|
196 |
|
197 |
+
output_image = pipe(
|
198 |
+
seeds = [seed],
|
199 |
+
width = output_width,
|
200 |
+
height = output_height,
|
201 |
+
prompt = prompt,
|
202 |
+
negative_prompt = negative_prompt,
|
203 |
+
image = enlarged_image,
|
204 |
+
mask_image = mask_image,
|
205 |
+
num_inference_steps = num_inference_steps,
|
206 |
+
guidance_scale = guidance_scale,
|
207 |
+
denoising_steps = denoising_steps,
|
208 |
+
show_progress_bar = True
|
209 |
+
).images[0]
|
210 |
+
|
211 |
+
if limitation != "":
|
212 |
+
output_image = output_image.resize((original_width, original_height))
|
213 |
|
214 |
if debug_mode == False:
|
215 |
input_image = None
|
|
|
240 |
gr.Markdown(
|
241 |
"""
|
242 |
<p style="text-align: center;"><b><big><big><big>Uncrop</big></big></big></b></p>
|
243 |
+
<p style="text-align: center;">Enlarges the point of view of your image, freely, without account, without watermark, without installation, which can be downloaded</p>
|
244 |
<br/>
|
245 |
<br/>
|
246 |
🚀 Powered by <i>SDXL 1.0</i> artificial intellingence. For illustration purpose, not information purpose. The new content is not based on real information but imagination.
|
|
|
259 |
<a href='https://huggingface.co/spaces/Fabrice-TIERCELIN/Uncrop?duplicate=true'><img src='https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14'></a>
|
260 |
<br/>
|
261 |
⚖️ You can use, modify and share the generated images but not for commercial uses.
|
|
|
262 |
"""
|
263 |
)
|
264 |
with gr.Row():
|
|
|
376 |
],
|
377 |
examples = [
|
378 |
[
|
379 |
+
"Example1.webp",
|
380 |
+
1024,
|
381 |
+
1024,
|
382 |
+
1024,
|
383 |
+
1024,
|
384 |
+
"An asian woman, black hair, ultrarealistic, realistic, photorealistic, 8k",
|
385 |
+
"Border, frame, painting, scribbling, smear, noise, blur, watermark",
|
386 |
+
20,
|
387 |
+
1000,
|
388 |
+
20,
|
389 |
+
7,
|
390 |
+
True,
|
391 |
+
42,
|
392 |
+
False
|
393 |
+
],
|
394 |
+
[
|
395 |
+
"Example2.png",
|
396 |
+
1024,
|
397 |
+
1024,
|
398 |
+
1024,
|
399 |
+
1024,
|
400 |
+
"Black man, jumping in the air, outside, ultrarealistic, realistic, photorealistic, 8k",
|
401 |
+
"Border, frame, painting, scribbling, smear, noise, blur, watermark",
|
402 |
+
20,
|
403 |
+
1000,
|
404 |
+
20,
|
405 |
+
7,
|
406 |
+
True,
|
407 |
+
42,
|
408 |
+
False
|
409 |
+
],
|
410 |
+
[
|
411 |
+
"Example3.jpg",
|
412 |
+
0,
|
413 |
+
512,
|
414 |
+
0,
|
415 |
+
512,
|
416 |
+
"An old yellow car, in a town, ultrarealistic, realistic, photorealistic, 8k",
|
417 |
"Border, frame, painting, scribbling, smear, noise, blur, watermark",
|
418 |
20,
|
419 |
1000,
|