ManishThota commited on
Commit
df2ba9f
1 Parent(s): a21637d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -111,23 +111,23 @@ def download_csv(csv_content):
111
  )
112
 
113
  # Define Gradio interface
114
- with gr.Blocks() as iface: # Using gr.Blocks() context
115
  with gr.Row():
116
  file_input = gr.File(label="Upload Videos", file_count="multiple")
117
  question_input = gr.CheckboxGroup(["hands_free", "standing/sitting", "interaction_with_background", "indoors/outdoors"],
118
- label="Select Questions to Apply")
119
 
 
 
120
  with gr.Row():
121
  json_output = gr.JSON(label="Analysis Results (JSON)")
122
  csv_output = gr.Textbox(label="CSV Results", lines=15)
123
 
124
- download_button = gr.Button("Download CSV") # Create button instance
125
-
126
- # Link button click to download function
127
- download_button.click(download_csv, inputs=csv_output, outputs=download_button)
128
 
129
- # Call the analyze_videos function to handle the analysis
130
- file_input.change(analyze_videos, inputs=[file_input, question_input], outputs=[json_output, csv_output])
 
131
 
132
  if __name__ == "__main__":
133
  iface.launch(debug=True)
 
111
  )
112
 
113
  # Define Gradio interface
114
+ with gr.Blocks() as iface:
115
  with gr.Row():
116
  file_input = gr.File(label="Upload Videos", file_count="multiple")
117
  question_input = gr.CheckboxGroup(["hands_free", "standing/sitting", "interaction_with_background", "indoors/outdoors"],
118
+ label="Select Questions to Apply")
119
 
120
+ process_button = gr.Button("Process Videos") # Process button below checkboxes
121
+
122
  with gr.Row():
123
  json_output = gr.JSON(label="Analysis Results (JSON)")
124
  csv_output = gr.Textbox(label="CSV Results", lines=15)
125
 
126
+ download_button = gr.Button("Download CSV")
 
 
 
127
 
128
+ # Link buttons to their respective functions
129
+ process_button.click(analyze_videos, inputs=[file_input, question_input], outputs=[json_output, csv_output])
130
+ download_button.click(download_csv, inputs=csv_output, outputs=download_button)
131
 
132
  if __name__ == "__main__":
133
  iface.launch(debug=True)