Spaces:
Running
Running
Add negative prompt
Browse files
app.py
CHANGED
@@ -109,16 +109,22 @@ def predict(source_img, enlarge_top, enlarge_right, enlarge_bottom, enlarge_left
|
|
109 |
progress(None, desc = "Processing...")
|
110 |
|
111 |
output_image = pipe(seeds=[seed], width = output_width, height = output_height, prompt = prompt, negative_prompt = negative_prompt, image = enlarged_image, mask_image = mask_image, num_inference_steps = num_inference_steps, guidance_scale = guidance_scale, denoising_steps = denoising_steps, show_progress_bar = True).images[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
return [
|
113 |
output_image,
|
114 |
-
|
115 |
input_image,
|
116 |
enlarged_image,
|
117 |
mask_image
|
118 |
]
|
119 |
|
120 |
title = "Uncrop"
|
121 |
-
description = "<p style='text-align: center;'>Enlarges the point of view of your image, up to 1 million pixels, freely, without account, without watermark, which can be downloaded</p><br/><br
|
122 |
gr.Interface(fn = predict, inputs = [
|
123 |
gr.Image(label = "Your image", source = "upload", type = "numpy"),
|
124 |
gr.Number(minimum = 0, value = 64, precision = 0, label = "Enlarge on top", info = "in pixels"),
|
@@ -126,7 +132,7 @@ gr.Interface(fn = predict, inputs = [
|
|
126 |
gr.Number(minimum = 0, value = 64, precision = 0, label = "Enlarge on bottom", info = "in pixels"),
|
127 |
gr.Number(minimum = 0, value = 64, precision = 0, label = "Enlarge on left", info = "in pixels"),
|
128 |
gr.Textbox(label = 'Prompt', info = "Describe the subject, the background and the style of image; 77 token limit", placeholder = 'Describe what you want to see in the entire image'),
|
129 |
-
gr.Textbox(label = 'Negative prompt', placeholder = 'Describe what you do NOT want to see in the entire image', value = 'Border, frame, painting, scribbling, smear, noise, blur'),
|
130 |
gr.Slider(minimum = 0, maximum = 1000, value = 1000, step = 1, label = "Denoising", info = "lower=irrelevant result, higher=relevant result"),
|
131 |
gr.Slider(minimum = 10, maximum = 25, value = 10, step = 1, label = "Number of inference steps", info = "lower=faster, higher=image quality"),
|
132 |
gr.Slider(minimum = 1, maximum = 13, value = 7, step = 0.1, label = "Classifier-Free Guidance Scale", info = "lower=image quality, higher=follow the prompt"),
|
@@ -135,7 +141,7 @@ gr.Interface(fn = predict, inputs = [
|
|
135 |
gr.Checkbox(label = "Debug mode", value = True, info = "Show intermediate results")
|
136 |
], outputs = [
|
137 |
gr.Image(label = "Uncropped image"),
|
138 |
-
gr.Label(
|
139 |
gr.Image(label = "Original image"),
|
140 |
gr.Image(label = "Enlarged image"),
|
141 |
gr.Image(label = "Mask image")
|
|
|
109 |
progress(None, desc = "Processing...")
|
110 |
|
111 |
output_image = pipe(seeds=[seed], width = output_width, height = output_height, prompt = prompt, negative_prompt = negative_prompt, image = enlarged_image, mask_image = mask_image, num_inference_steps = num_inference_steps, guidance_scale = guidance_scale, denoising_steps = denoising_steps, show_progress_bar = True).images[0]
|
112 |
+
|
113 |
+
if debug_mode == False:
|
114 |
+
input_image = None
|
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
|
124 |
]
|
125 |
|
126 |
title = "Uncrop"
|
127 |
+
description = "<p style='text-align: center;'>Enlarges the point of view of your image, up to 1 million pixels, freely, without account, without watermark, which can be downloaded</p><br/><br/>🚀 Powered by <i>SDXL 1.0</i> artificial intellingence<br/><ul><li>If you need to change the <b>view angle</b> of your image, I recommend you to use <i>Zero123</i>,</li><li>If you need to <b>upscale</b> your image, I recommend you to use <i>Ilaria Upscaler</i>,</li><li>If you need to <b>slightly change</b> your image, I recommend you to use <i>Image-to-Image SDXL</i>,</li><li>If you need to change <b>one detail</b> on your image, I recommend you to use <i>Inpaint SDXL</i>.</li></ul><br/>🐌 Slow process... ~20 min with 20 inference steps, ~6 hours with 25 inference steps.<br>You can duplicate this space on a free account, it works on CPU.<br/><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><br/><br/>⚖️ You can use, modify and share the generated images but not for commercial uses."
|
128 |
gr.Interface(fn = predict, inputs = [
|
129 |
gr.Image(label = "Your image", source = "upload", type = "numpy"),
|
130 |
gr.Number(minimum = 0, value = 64, precision = 0, label = "Enlarge on top", info = "in pixels"),
|
|
|
132 |
gr.Number(minimum = 0, value = 64, precision = 0, label = "Enlarge on bottom", info = "in pixels"),
|
133 |
gr.Number(minimum = 0, value = 64, precision = 0, label = "Enlarge on left", info = "in pixels"),
|
134 |
gr.Textbox(label = 'Prompt', info = "Describe the subject, the background and the style of image; 77 token limit", placeholder = 'Describe what you want to see in the entire image'),
|
135 |
+
gr.Textbox(label = 'Negative prompt', placeholder = 'Describe what you do NOT want to see in the entire image', value = 'Border, frame, painting, scribbling, smear, noise, blur, watermark'),
|
136 |
gr.Slider(minimum = 0, maximum = 1000, value = 1000, step = 1, label = "Denoising", info = "lower=irrelevant result, higher=relevant result"),
|
137 |
gr.Slider(minimum = 10, maximum = 25, value = 10, step = 1, label = "Number of inference steps", info = "lower=faster, higher=image quality"),
|
138 |
gr.Slider(minimum = 1, maximum = 13, value = 7, step = 0.1, label = "Classifier-Free Guidance Scale", info = "lower=image quality, higher=follow the prompt"),
|
|
|
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")
|