harrim-nv commited on
Commit
ffad500
·
verified ·
1 Parent(s): ef438e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -10
app.py CHANGED
@@ -290,26 +290,36 @@ with gr.Blocks(title="Cosmos-Reason1", theme=gr.themes.Soft()) as demo:
290
  outputs=[output, status]
291
  )
292
 
293
- # Example data: (image_path, video_path, question, temperature, top_p, repetition_penalty, max_tokens, role, custom_role_text)
294
  example_data = [
295
  [
296
- "group_in_park.jpg",
297
- "What is happening in this image?",
298
- "General Assistant"
299
  ]
300
  ]
301
-
302
  # Add examples section to the interface
303
- gr.Examples(
304
  examples=example_data,
 
 
 
 
 
 
 
305
  inputs=[
306
  image_input,
 
307
  text_input,
308
- role_selector
 
 
 
 
 
309
  ],
310
- outputs=[output, status],
311
- fn=process_input,
312
- cache_examples=True
313
  )
314
 
315
  if __name__ == "__main__":
 
290
  outputs=[output, status]
291
  )
292
 
293
+ # Example data:
294
  example_data = [
295
  [
296
+ "group_in_park.jpg", # Replace with your actual image path or URL
297
+ "What is happening in this image?"
 
298
  ]
299
  ]
300
+
301
  # Add examples section to the interface
302
+ example_component = gr.Examples(
303
  examples=example_data,
304
+ inputs=[image_input, text_input],
305
+ label="Click an example to load and auto-submit"
306
+ )
307
+
308
+ # Auto-submit when an example is clicked
309
+ example_component.dataset.click(
310
+ fn=process_input,
311
  inputs=[
312
  image_input,
313
+ video_input,
314
  text_input,
315
+ temperature,
316
+ top_p,
317
+ repetition_penalty,
318
+ max_tokens,
319
+ role_selector,
320
+ custom_role_text
321
  ],
322
+ outputs=[output, status]
 
 
323
  )
324
 
325
  if __name__ == "__main__":