marstin commited on
Commit
c274a6b
·
1 Parent(s): 3f1514e

[martin-dev] fix gpu handle

Browse files
Files changed (1) hide show
  1. 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
- # Custom interactive examples (safe for GPU Spaces)
639
- # gr.Markdown("### Example Prompts (Click to Insert)")
640
- # with gr.Row():
641
- # gr.Button("Example 1").click(
642
- # fn=lambda: ("What is in this image? Describe in one word.", None, None),
643
- # outputs=[instruction_input, image1_input, image2_input]
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