Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -80,14 +80,14 @@ def extract_exif_data(image):
|
|
| 80 |
# and return the exif bytes. For now, it does nothing.
|
| 81 |
return None
|
| 82 |
|
| 83 |
-
def on_gpu_configurable(duration=60):
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
|
| 92 |
|
| 93 |
class UpscalerApp:
|
|
@@ -304,7 +304,7 @@ class UpscalerApp:
|
|
| 304 |
reveal_text = f"Thank you! Your preference for **{choice}** has been recorded.\n\n- **Image A was:** {model_a}\n- **Image B was:** {model_b}"
|
| 305 |
return reveal_text, gr.Button(interactive=False), gr.Button(interactive=False)
|
| 306 |
|
| 307 |
-
@on_gpu_configurable(duration=59)
|
| 308 |
def playground_upscale(self, image, upscaler_name, upscaler_size, tile, tile_overlap, half):
|
| 309 |
if image is None or upscaler_name is None: return None
|
| 310 |
return self.process_upscale(image, upscaler_name, upscaler_size, tile, tile_overlap, half)
|
|
@@ -369,7 +369,7 @@ class UpscalerApp:
|
|
| 369 |
output_image_playground = gr.Image(label="Upscaled Result", interactive=False)
|
| 370 |
|
| 371 |
run_button_playground.click(
|
| 372 |
-
fn=
|
| 373 |
inputs=[input_image_playground, upscaler_model_dropdown, upscaler_size_slider, tile_slider, tile_overlap_slider, half_checkbox],
|
| 374 |
outputs=[output_image_playground]
|
| 375 |
)
|
|
@@ -380,9 +380,9 @@ class UpscalerApp:
|
|
| 380 |
self.ui.launch(**kwargs)
|
| 381 |
|
| 382 |
|
| 383 |
-
@spaces.GPU
|
| 384 |
-
def
|
| 385 |
-
return
|
| 386 |
|
| 387 |
# --- Main Execution Block ---
|
| 388 |
if __name__ == "__main__":
|
|
|
|
| 80 |
# and return the exif bytes. For now, it does nothing.
|
| 81 |
return None
|
| 82 |
|
| 83 |
+
# def on_gpu_configurable(duration=60):
|
| 84 |
+
# def decorator(func):
|
| 85 |
+
# @functools.wraps(func)
|
| 86 |
+
# @spaces.GPU(duration=duration)
|
| 87 |
+
# def wrapper(*args, **kwargs):
|
| 88 |
+
# return func(*args, **kwargs)
|
| 89 |
+
# return wrapper
|
| 90 |
+
# return decorator
|
| 91 |
|
| 92 |
|
| 93 |
class UpscalerApp:
|
|
|
|
| 304 |
reveal_text = f"Thank you! Your preference for **{choice}** has been recorded.\n\n- **Image A was:** {model_a}\n- **Image B was:** {model_b}"
|
| 305 |
return reveal_text, gr.Button(interactive=False), gr.Button(interactive=False)
|
| 306 |
|
| 307 |
+
# @on_gpu_configurable(duration=59)
|
| 308 |
def playground_upscale(self, image, upscaler_name, upscaler_size, tile, tile_overlap, half):
|
| 309 |
if image is None or upscaler_name is None: return None
|
| 310 |
return self.process_upscale(image, upscaler_name, upscaler_size, tile, tile_overlap, half)
|
|
|
|
| 369 |
output_image_playground = gr.Image(label="Upscaled Result", interactive=False)
|
| 370 |
|
| 371 |
run_button_playground.click(
|
| 372 |
+
fn=gpu_tab2,
|
| 373 |
inputs=[input_image_playground, upscaler_model_dropdown, upscaler_size_slider, tile_slider, tile_overlap_slider, half_checkbox],
|
| 374 |
outputs=[output_image_playground]
|
| 375 |
)
|
|
|
|
| 380 |
self.ui.launch(**kwargs)
|
| 381 |
|
| 382 |
|
| 383 |
+
@spaces.GPU(duration=60)
|
| 384 |
+
def gpu_tab2(*args, **kwargs):
|
| 385 |
+
return self.playground_upscale(*args, **kwargs)
|
| 386 |
|
| 387 |
# --- Main Execution Block ---
|
| 388 |
if __name__ == "__main__":
|