Spaces:
Running
on
Zero
Running
on
Zero
MCP enabled
Browse files
app.py
CHANGED
@@ -180,6 +180,21 @@ def preprocess_image(input_image: Image.Image) -> Image.Image:
|
|
180 |
|
181 |
@spaces.GPU()
|
182 |
def preprocess_n_magnify(input_image: Image.Image):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
processed_img = preprocess_image(input_image)
|
184 |
|
185 |
img, magnified_img = magnify(processed_img)
|
@@ -338,7 +353,7 @@ with gr.Blocks(css=css, theme=theme) as demo:
|
|
338 |
inputs = [
|
339 |
input_image,
|
340 |
]
|
341 |
-
run_button.click(fn=
|
342 |
-
input_image.upload(fn=preprocess_image,inputs=input_image, outputs=input_image)
|
343 |
|
344 |
-
demo.launch(share=True)
|
|
|
180 |
|
181 |
@spaces.GPU()
|
182 |
def preprocess_n_magnify(input_image: Image.Image):
|
183 |
+
"""
|
184 |
+
Preprocess the input image and perform a single-step 4× magnification using the SeeSR pipeline.
|
185 |
+
|
186 |
+
This function first resizes the input to fit within a 512×512 thumbnail, then applies the full
|
187 |
+
magnification through ControlNet-guided diffusion—to produce a high-resolution, 4× upscaled image.
|
188 |
+
|
189 |
+
Args:
|
190 |
+
input_image (PIL.Image.Image): The source image to preprocess and magnify.
|
191 |
+
|
192 |
+
Returns:
|
193 |
+
tuple[PIL.Image.Image, PIL.Image.Image]:
|
194 |
+
- The resized (thumbnail) version of the input.
|
195 |
+
- The final 4× magnified output image.
|
196 |
+
"""
|
197 |
+
|
198 |
processed_img = preprocess_image(input_image)
|
199 |
|
200 |
img, magnified_img = magnify(processed_img)
|
|
|
353 |
inputs = [
|
354 |
input_image,
|
355 |
]
|
356 |
+
run_button.click(fn=preprocess_n_magnify, inputs=input_image, outputs=[result_gallery])
|
357 |
+
input_image.upload(fn=preprocess_image,inputs=input_image, outputs=input_image, show_api=False)
|
358 |
|
359 |
+
demo.launch(share=True, mcp_server=True)
|