Jyothirmai commited on
Commit
678675f
·
verified ·
1 Parent(s): bee3886

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -91,7 +91,15 @@ with gr.Blocks() as demo:
91
 
92
  # Event handlers
93
  generate_button.click(predict, [image, model_choice, max_tokens, temperature], caption)
94
- image_table.click(predict_from_table, [image_table, model_choice], outputs=[image_display, caption])
 
 
 
 
 
 
 
 
95
 
96
 
97
  demo.launch()
 
91
 
92
  # Event handlers
93
  generate_button.click(predict, [image, model_choice, max_tokens, temperature], caption)
94
+
95
+ # Create an event handler for the entire Dataframe
96
+ def dataframe_selected(index, row, model_choice):
97
+ if row is not None: # Check if an actual row was selected
98
+ return predict_from_table(row, model_choice)
99
+
100
+ # Attach the function to the dataframe
101
+ image_table.change(dataframe_selected, inputs=[image_table, model_choice], outputs=[image_display, caption])
102
+
103
 
104
 
105
  demo.launch()