ravi-vc commited on
Commit
f1b8462
·
verified ·
1 Parent(s): 1911fb8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -174,8 +174,7 @@ def create_interface():
174
 
175
  # Download section
176
  csv_download = gr.File(
177
- label="Download CSV",
178
- visible=False
179
  )
180
 
181
  # Example images
@@ -195,12 +194,17 @@ def create_interface():
195
 
196
  if csv_data:
197
  # Create temporary CSV file for download
198
- csv_file = io.StringIO()
199
- csv_file.write(csv_data)
200
- csv_file.seek(0)
201
- return raw, table, gr.File(value=csv_data, visible=True)
 
 
 
 
 
202
  else:
203
- return raw, table, gr.File(visible=False)
204
 
205
  extract_btn.click(
206
  fn=process_and_download,
 
174
 
175
  # Download section
176
  csv_download = gr.File(
177
+ label="Download CSV"
 
178
  )
179
 
180
  # Example images
 
194
 
195
  if csv_data:
196
  # Create temporary CSV file for download
197
+ import tempfile
198
+ import os
199
+
200
+ # Create a temporary file
201
+ temp_file = tempfile.NamedTemporaryFile(mode='w', suffix='.csv', delete=False)
202
+ temp_file.write(csv_data)
203
+ temp_file.close()
204
+
205
+ return raw, table, temp_file.name
206
  else:
207
+ return raw, table, None
208
 
209
  extract_btn.click(
210
  fn=process_and_download,