ManishThota commited on
Commit
62c37f8
·
verified ·
1 Parent(s): 3642fda

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -194,12 +194,12 @@ def gradio_predict(video,image, question):
194
 
195
 
196
  def convert_and_save(data):
197
- # Assuming 'data' is a dictionary to convert into a DataFrame and save as CSV
198
  df = pd.DataFrame([data])
199
- csv_buffer = StringIO()
200
- df.to_csv(csv_buffer, index=False)
201
- csv_buffer.seek(0) # Move to the start of the StringIO buffer
202
- return ("annotations.csv", csv_buffer.getvalue())
203
 
204
  css = """
205
  #container{
@@ -235,7 +235,7 @@ with gr.Blocks(css = css) as app:
235
  with gr.Column():
236
  answer = gr.TextArea(label="Answer")
237
  save_btn = gr.Button("Save as CSV")
238
- download_link = gr.File(label="Download CSV")
239
 
240
  # Make sure the inputs and outputs match in your click function
241
 
 
194
 
195
 
196
  def convert_and_save(data):
197
+ # Assuming 'data' is a dictionary that we want to save as CSV
198
  df = pd.DataFrame([data])
199
+ # Convert the DataFrame to a CSV string
200
+ csv_string = df.to_csv(index=False)
201
+ # Return a tuple with the filename and the CSV string
202
+ return ("annotations.csv", csv_string)
203
 
204
  css = """
205
  #container{
 
235
  with gr.Column():
236
  answer = gr.TextArea(label="Answer")
237
  save_btn = gr.Button("Save as CSV")
238
+ download_link = gr.Dataframe(label="Download CSV")
239
 
240
  # Make sure the inputs and outputs match in your click function
241