Vasudevakrishna commited on
Commit
e6481ca
·
verified ·
1 Parent(s): 7eb72e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -14
app.py CHANGED
@@ -83,10 +83,10 @@ def generate_answers(img=None, aud = None, q = None, max_tokens = 30):
83
 
84
  # List of examples (image, audio, question, max_tokens)
85
  examples = [
86
- ["./examples/Image_1.jpg", None, "Explain image?", 20],
87
- ["./examples/Image_2.jpg", None, "How many animals are there in image?", 10],
88
- ["./examples/Image_3.jpg", None, "What is in the image?", 20],
89
- ["./examples/Image_4.jpg", None, "What represents this Image?", 20],
90
  ]
91
 
92
  with gr.Blocks() as demo:
@@ -113,16 +113,7 @@ with gr.Blocks() as demo:
113
  # Add examples
114
  # gr.Examples(examples=examples, inputs=[image, audio_q, question, max_tokens], outputs=answer)
115
  # Add examples
116
- gr.Examples(examples=examples, inputs=[image, audio_q, question, max_tokens])
117
-
118
- # Automatically trigger the submit button when examples are loaded
119
- def submit_on_example(image, audio_q, question, max_tokens):
120
- return generate_answers(image, audio_q, question, max_tokens)
121
-
122
- # Automatically call generate_answers when an example is clicked
123
- gr.Examples(examples=examples, inputs=[image, audio_q, question, max_tokens], outputs=[answer]).click(
124
- fn=submit_on_example, inputs=[image, audio_q, question, max_tokens], outputs=[answer]
125
- )
126
 
127
 
128
 
 
83
 
84
  # List of examples (image, audio, question, max_tokens)
85
  examples = [
86
+ ["./examples/Image_1.jpg", "Explain image?", 20],
87
+ ["./examples/Image_2.jpg", "How many animals are there in image?", 10],
88
+ ["./examples/Image_3.jpg", "What is in the image?", 20],
89
+ ["./examples/Image_4.jpg", "What represents this Image?", 20],
90
  ]
91
 
92
  with gr.Blocks() as demo:
 
113
  # Add examples
114
  # gr.Examples(examples=examples, inputs=[image, audio_q, question, max_tokens], outputs=answer)
115
  # Add examples
116
+ gr.Examples(examples=examples, inputs=[image, None, question, max_tokens])
 
 
 
 
 
 
 
 
 
117
 
118
 
119