Spaces:
Running
on
Zero
Running
on
Zero
hide unnecessary api endpoints for mcp clarity
Browse files
app.py
CHANGED
|
@@ -421,41 +421,47 @@ with gr.Blocks(css=css) as demo:
|
|
| 421 |
use_as_input_button.click(
|
| 422 |
fn=use_output_as_input,
|
| 423 |
inputs=[result],
|
| 424 |
-
outputs=[input_image]
|
|
|
|
| 425 |
)
|
| 426 |
|
| 427 |
target_ratio.change(
|
| 428 |
fn=preload_presets,
|
| 429 |
inputs=[target_ratio, width_slider, height_slider],
|
| 430 |
outputs=[width_slider, height_slider, settings_panel],
|
| 431 |
-
queue=False
|
|
|
|
| 432 |
)
|
| 433 |
|
| 434 |
width_slider.change(
|
| 435 |
fn=select_the_right_preset,
|
| 436 |
inputs=[width_slider, height_slider],
|
| 437 |
outputs=[target_ratio],
|
| 438 |
-
queue=False
|
|
|
|
| 439 |
)
|
| 440 |
|
| 441 |
height_slider.change(
|
| 442 |
fn=select_the_right_preset,
|
| 443 |
inputs=[width_slider, height_slider],
|
| 444 |
outputs=[target_ratio],
|
| 445 |
-
queue=False
|
|
|
|
| 446 |
)
|
| 447 |
|
| 448 |
resize_option.change(
|
| 449 |
fn=toggle_custom_resize_slider,
|
| 450 |
inputs=[resize_option],
|
| 451 |
outputs=[custom_resize_percentage],
|
| 452 |
-
queue=False
|
|
|
|
| 453 |
)
|
| 454 |
|
| 455 |
run_button.click( # Clear the result
|
| 456 |
fn=clear_result,
|
| 457 |
inputs=None,
|
| 458 |
-
outputs=result
|
|
|
|
| 459 |
).then( # Generate the new image
|
| 460 |
fn=infer,
|
| 461 |
inputs=[input_image, width_slider, height_slider, overlap_percentage, num_inference_steps,
|
|
@@ -465,17 +471,20 @@ with gr.Blocks(css=css) as demo:
|
|
| 465 |
).then( # Update the history gallery
|
| 466 |
fn=lambda x, history: update_history(x[1], history),
|
| 467 |
inputs=[result, history_gallery],
|
| 468 |
-
outputs=history_gallery
|
|
|
|
| 469 |
).then( # Show the "Use as Input Image" button
|
| 470 |
fn=lambda: gr.update(visible=True),
|
| 471 |
inputs=None,
|
| 472 |
-
outputs=use_as_input_button
|
|
|
|
| 473 |
)
|
| 474 |
|
| 475 |
prompt_input.submit( # Clear the result
|
| 476 |
fn=clear_result,
|
| 477 |
inputs=None,
|
| 478 |
-
outputs=result
|
|
|
|
| 479 |
).then( # Generate the new image
|
| 480 |
fn=infer,
|
| 481 |
inputs=[input_image, width_slider, height_slider, overlap_percentage, num_inference_steps,
|
|
@@ -485,11 +494,13 @@ with gr.Blocks(css=css) as demo:
|
|
| 485 |
).then( # Update the history gallery
|
| 486 |
fn=lambda x, history: update_history(x[1], history),
|
| 487 |
inputs=[result, history_gallery],
|
| 488 |
-
outputs=history_gallery
|
|
|
|
| 489 |
).then( # Show the "Use as Input Image" button
|
| 490 |
fn=lambda: gr.update(visible=True),
|
| 491 |
inputs=None,
|
| 492 |
-
outputs=use_as_input_button
|
|
|
|
| 493 |
)
|
| 494 |
|
| 495 |
preview_button.click(
|
|
@@ -497,7 +508,8 @@ with gr.Blocks(css=css) as demo:
|
|
| 497 |
inputs=[input_image, width_slider, height_slider, overlap_percentage, resize_option, custom_resize_percentage, alignment_dropdown,
|
| 498 |
overlap_left, overlap_right, overlap_top, overlap_bottom],
|
| 499 |
outputs=preview_image,
|
| 500 |
-
queue=False
|
|
|
|
| 501 |
)
|
| 502 |
|
| 503 |
demo.queue(max_size=12).launch(share=False, show_error=True, mcp_server=True)
|
|
|
|
| 421 |
use_as_input_button.click(
|
| 422 |
fn=use_output_as_input,
|
| 423 |
inputs=[result],
|
| 424 |
+
outputs=[input_image],
|
| 425 |
+
show_api=False
|
| 426 |
)
|
| 427 |
|
| 428 |
target_ratio.change(
|
| 429 |
fn=preload_presets,
|
| 430 |
inputs=[target_ratio, width_slider, height_slider],
|
| 431 |
outputs=[width_slider, height_slider, settings_panel],
|
| 432 |
+
queue=False,
|
| 433 |
+
show_api=False
|
| 434 |
)
|
| 435 |
|
| 436 |
width_slider.change(
|
| 437 |
fn=select_the_right_preset,
|
| 438 |
inputs=[width_slider, height_slider],
|
| 439 |
outputs=[target_ratio],
|
| 440 |
+
queue=False,
|
| 441 |
+
show_api=False
|
| 442 |
)
|
| 443 |
|
| 444 |
height_slider.change(
|
| 445 |
fn=select_the_right_preset,
|
| 446 |
inputs=[width_slider, height_slider],
|
| 447 |
outputs=[target_ratio],
|
| 448 |
+
queue=False,
|
| 449 |
+
show_api=False
|
| 450 |
)
|
| 451 |
|
| 452 |
resize_option.change(
|
| 453 |
fn=toggle_custom_resize_slider,
|
| 454 |
inputs=[resize_option],
|
| 455 |
outputs=[custom_resize_percentage],
|
| 456 |
+
queue=False,
|
| 457 |
+
show_api=False
|
| 458 |
)
|
| 459 |
|
| 460 |
run_button.click( # Clear the result
|
| 461 |
fn=clear_result,
|
| 462 |
inputs=None,
|
| 463 |
+
outputs=result,,
|
| 464 |
+
show_api=False
|
| 465 |
).then( # Generate the new image
|
| 466 |
fn=infer,
|
| 467 |
inputs=[input_image, width_slider, height_slider, overlap_percentage, num_inference_steps,
|
|
|
|
| 471 |
).then( # Update the history gallery
|
| 472 |
fn=lambda x, history: update_history(x[1], history),
|
| 473 |
inputs=[result, history_gallery],
|
| 474 |
+
outputs=history_gallery,,
|
| 475 |
+
show_api=False
|
| 476 |
).then( # Show the "Use as Input Image" button
|
| 477 |
fn=lambda: gr.update(visible=True),
|
| 478 |
inputs=None,
|
| 479 |
+
outputs=use_as_input_button,,
|
| 480 |
+
show_api=False
|
| 481 |
)
|
| 482 |
|
| 483 |
prompt_input.submit( # Clear the result
|
| 484 |
fn=clear_result,
|
| 485 |
inputs=None,
|
| 486 |
+
outputs=result,,
|
| 487 |
+
show_api=False
|
| 488 |
).then( # Generate the new image
|
| 489 |
fn=infer,
|
| 490 |
inputs=[input_image, width_slider, height_slider, overlap_percentage, num_inference_steps,
|
|
|
|
| 494 |
).then( # Update the history gallery
|
| 495 |
fn=lambda x, history: update_history(x[1], history),
|
| 496 |
inputs=[result, history_gallery],
|
| 497 |
+
outputs=history_gallery,,
|
| 498 |
+
show_api=False
|
| 499 |
).then( # Show the "Use as Input Image" button
|
| 500 |
fn=lambda: gr.update(visible=True),
|
| 501 |
inputs=None,
|
| 502 |
+
outputs=use_as_input_button,,
|
| 503 |
+
show_api=False
|
| 504 |
)
|
| 505 |
|
| 506 |
preview_button.click(
|
|
|
|
| 508 |
inputs=[input_image, width_slider, height_slider, overlap_percentage, resize_option, custom_resize_percentage, alignment_dropdown,
|
| 509 |
overlap_left, overlap_right, overlap_top, overlap_bottom],
|
| 510 |
outputs=preview_image,
|
| 511 |
+
queue=False,
|
| 512 |
+
show_api=False
|
| 513 |
)
|
| 514 |
|
| 515 |
demo.queue(max_size=12).launch(share=False, show_error=True, mcp_server=True)
|