[martin-dev] fix gpu handle
Browse files- demo/launch_gradio.py +8 -16
demo/launch_gradio.py
CHANGED
|
@@ -441,6 +441,7 @@ def get_module_similarity_pooled(
|
|
| 441 |
hook_handle.remove()
|
| 442 |
|
| 443 |
|
|
|
|
| 444 |
def process_dual_inputs(
|
| 445 |
model_choice: str,
|
| 446 |
selected_layer: str,
|
|
@@ -546,7 +547,6 @@ def process_dual_inputs(
|
|
| 546 |
return None, f'Error: {str(e)}'
|
| 547 |
|
| 548 |
|
| 549 |
-
@GPU
|
| 550 |
def create_demo() -> gr.Blocks:
|
| 551 |
"""Create and configure the Gradio demo interface for dual image comparison.
|
| 552 |
|
|
@@ -635,21 +635,13 @@ def create_demo() -> gr.Blocks:
|
|
| 635 |
outputs=[plot_output, info_output]
|
| 636 |
)
|
| 637 |
|
| 638 |
-
#
|
| 639 |
-
|
| 640 |
-
|
| 641 |
-
|
| 642 |
-
|
| 643 |
-
|
| 644 |
-
|
| 645 |
-
# gr.Button("Example 2").click(
|
| 646 |
-
# fn=lambda: ("Describe the main object in the picture in one word.", None, None),
|
| 647 |
-
# outputs=[instruction_input, image1_input, image2_input]
|
| 648 |
-
# )
|
| 649 |
-
# gr.Button("Example 3").click(
|
| 650 |
-
# fn=lambda: ("What color is the dominant object? Describe in one word.", None, None),
|
| 651 |
-
# outputs=[instruction_input, image1_input, image2_input]
|
| 652 |
-
# )
|
| 653 |
|
| 654 |
return demo
|
| 655 |
|
|
|
|
| 441 |
hook_handle.remove()
|
| 442 |
|
| 443 |
|
| 444 |
+
@GPU(duration=60)
|
| 445 |
def process_dual_inputs(
|
| 446 |
model_choice: str,
|
| 447 |
selected_layer: str,
|
|
|
|
| 547 |
return None, f'Error: {str(e)}'
|
| 548 |
|
| 549 |
|
|
|
|
| 550 |
def create_demo() -> gr.Blocks:
|
| 551 |
"""Create and configure the Gradio demo interface for dual image comparison.
|
| 552 |
|
|
|
|
| 635 |
outputs=[plot_output, info_output]
|
| 636 |
)
|
| 637 |
|
| 638 |
+
# Add examples
|
| 639 |
+
gr.Examples(
|
| 640 |
+
examples=[
|
| 641 |
+
[example1()], [example2()], [example3()]
|
| 642 |
+
],
|
| 643 |
+
inputs=[instruction_input, image1_input, image2_input]
|
| 644 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 645 |
|
| 646 |
return demo
|
| 647 |
|