marstin commited on
Commit
c3ba5a9
·
1 Parent(s): 0bea06e

[martin-dev] fix example 2; no cache for now

Browse files
Files changed (1) hide show
  1. demo/launch_gradio.py +16 -11
demo/launch_gradio.py CHANGED
@@ -625,17 +625,22 @@ def create_demo() -> gr.Blocks:
625
  outputs=[plot_output, info_output]
626
  )
627
 
628
- # Add examples
629
- gr.Examples(
630
- examples=[
631
- ['What is in this image? Describe in one word.', None, None],
632
- ['Describe the main object in the picture in one word.', None, None],
633
- ['What color is the dominant object? Describe in one word.', None, None],
634
- ],
635
- inputs=[instruction_input, image1_input, image2_input],
636
- label="Example Prompts",
637
- examples_per_page=3,
638
- )
 
 
 
 
 
639
 
640
  return demo
641
 
 
625
  outputs=[plot_output, info_output]
626
  )
627
 
628
+ # Custom interactive examples (safe for GPU Spaces)
629
+ gr.Markdown("### Example Prompts (Click to Insert)")
630
+
631
+ with gr.Row():
632
+ gr.Button("Example 1").click(
633
+ fn=lambda: ("What is in this image? Describe in one word.", None, None),
634
+ outputs=[instruction_input, image1_input, image2_input]
635
+ )
636
+ gr.Button("Example 2").click(
637
+ fn=lambda: ("Describe the main object in the picture in one word.", None, None),
638
+ outputs=[instruction_input, image1_input, image2_input]
639
+ )
640
+ gr.Button("Example 3").click(
641
+ fn=lambda: ("What color is the dominant object? Describe in one word.", None, None),
642
+ outputs=[instruction_input, image1_input, image2_input]
643
+ )
644
 
645
  return demo
646