Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -176,9 +176,17 @@ def preprocess_image(input_image: Image.Image) -> Image.Image:
|
|
176 |
img = input_image.copy()
|
177 |
img.thumbnail((256, 256), Image.Resampling.BILINEAR)
|
178 |
return img
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
@spaces.GPU()
|
181 |
-
def
|
182 |
input_image: Image.Image,
|
183 |
user_prompt = "",
|
184 |
positive_prompt = "clean, high-resolution, 8k, best quality, masterpiece",
|
@@ -323,14 +331,14 @@ with gr.Blocks(css=css, theme=theme) as demo:
|
|
323 |
inputs=[
|
324 |
input_image,
|
325 |
],
|
326 |
-
outputs=[result_gallery],
|
327 |
-
fn=
|
328 |
cache_examples=True,
|
329 |
)
|
330 |
inputs = [
|
331 |
input_image,
|
332 |
]
|
333 |
-
run_button.click(fn=
|
334 |
input_image.upload(fn=preprocess_image,inputs=input_image, outputs=[preprocessed_image])
|
335 |
|
336 |
demo.launch(share=True)
|
|
|
176 |
img = input_image.copy()
|
177 |
img.thumbnail((256, 256), Image.Resampling.BILINEAR)
|
178 |
return img
|
179 |
+
|
180 |
+
|
181 |
+
@spaces.GPU()
|
182 |
+
def preprocess_n_magnify(input_image: Image.Image):
|
183 |
+
preprocessed_img = preprocess_image(input_image)
|
184 |
+
preprocessed_img, magnified_img = magnify(preprocessed_img)
|
185 |
+
|
186 |
+
return preprocessed_img, preprocessed_img, magnified_img
|
187 |
|
188 |
@spaces.GPU()
|
189 |
+
def magnify(
|
190 |
input_image: Image.Image,
|
191 |
user_prompt = "",
|
192 |
positive_prompt = "clean, high-resolution, 8k, best quality, masterpiece",
|
|
|
331 |
inputs=[
|
332 |
input_image,
|
333 |
],
|
334 |
+
outputs=[preprocessed_image, result_gallery],
|
335 |
+
fn=preprocess_n_magnify,
|
336 |
cache_examples=True,
|
337 |
)
|
338 |
inputs = [
|
339 |
input_image,
|
340 |
]
|
341 |
+
run_button.click(fn=magnify, inputs=preprocessed_image, outputs=[result_gallery])
|
342 |
input_image.upload(fn=preprocess_image,inputs=input_image, outputs=[preprocessed_image])
|
343 |
|
344 |
demo.launch(share=True)
|