zumat commited on
Commit
df12c07
·
verified ·
1 Parent(s): e563211

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -102,7 +102,7 @@ def dataManipulator(converter, filepath):
102
  for record in records:
103
  writer.writerow(record)
104
 
105
- return gr.DownloadButton(label=f"Download {output_file}", value=output_file, interactive=True)
106
  if converter == "Calendar Converter":
107
  with open(filepath, 'rb') as file:
108
  calendar = Calendar.from_ical(file.read())
@@ -128,7 +128,7 @@ def dataManipulator(converter, filepath):
128
  for record in records:
129
  writer.writerow(record)
130
 
131
- return gr.DownloadButton(label=f"Download {output_file}", value=output_file, interactive=True)
132
  if converter == "AppleHealth Converter":
133
  tree = ET.parse(filepath)
134
  root = tree.getroot()
@@ -149,7 +149,7 @@ def dataManipulator(converter, filepath):
149
  for record in records:
150
  writer.writerow(record)
151
 
152
- return gr.DownloadButton(label=f"Download {output_file}", value=output_file, interactive=True)
153
  if converter == "AppleHealth GPS Converter":
154
  with open(filepath, 'r') as filepath:
155
  gpx = gpxpy.parse(filepath)
@@ -175,7 +175,7 @@ def dataManipulator(converter, filepath):
175
  for record in records:
176
  writer.writerow(record)
177
 
178
- return gr.DownloadButton(label=f"Download {output_file}", value=output_file, interactive=True)
179
  if converter == "WhatsApp Converter":
180
  with open(filepath, 'r', encoding='utf-8', errors='ignore') as file:
181
  lines = file.readlines()
@@ -214,7 +214,7 @@ def dataManipulator(converter, filepath):
214
  for record in records:
215
  writer.writerow(record)
216
 
217
- return gr.DownloadButton(label=f"Download {output_file}", value=output_file, interactive=True)
218
  if converter == "Google Foto Converter":
219
  records = []
220
  # Unzip the file
@@ -247,9 +247,9 @@ def dataManipulator(converter, filepath):
247
  for record in records:
248
  writer.writerow(record)
249
 
250
- return gr.DownloadButton(label=f"Download {output_file}", value=output_file, interactive=True)
251
  else:
252
- return gr.DownloadButton(label="Download not ready", value="output_file", interactive=False)
253
 
254
  except Exception as e:
255
  error_message = f"An error occurred: {str(e)}\n\nTraceback:\n{traceback.format_exc()}"
 
102
  for record in records:
103
  writer.writerow(record)
104
 
105
+ return gr.DownloadButton(label=f"Download {output_file}", value=output_file, interactive=True), ""
106
  if converter == "Calendar Converter":
107
  with open(filepath, 'rb') as file:
108
  calendar = Calendar.from_ical(file.read())
 
128
  for record in records:
129
  writer.writerow(record)
130
 
131
+ return gr.DownloadButton(label=f"Download {output_file}", value=output_file, interactive=True), ""
132
  if converter == "AppleHealth Converter":
133
  tree = ET.parse(filepath)
134
  root = tree.getroot()
 
149
  for record in records:
150
  writer.writerow(record)
151
 
152
+ return gr.DownloadButton(label=f"Download {output_file}", value=output_file, interactive=True), ""
153
  if converter == "AppleHealth GPS Converter":
154
  with open(filepath, 'r') as filepath:
155
  gpx = gpxpy.parse(filepath)
 
175
  for record in records:
176
  writer.writerow(record)
177
 
178
+ return gr.DownloadButton(label=f"Download {output_file}", value=output_file, interactive=True), ""
179
  if converter == "WhatsApp Converter":
180
  with open(filepath, 'r', encoding='utf-8', errors='ignore') as file:
181
  lines = file.readlines()
 
214
  for record in records:
215
  writer.writerow(record)
216
 
217
+ return gr.DownloadButton(label=f"Download {output_file}", value=output_file, interactive=True), ""
218
  if converter == "Google Foto Converter":
219
  records = []
220
  # Unzip the file
 
247
  for record in records:
248
  writer.writerow(record)
249
 
250
+ return gr.DownloadButton(label=f"Download {output_file}", value=output_file, interactive=True), ""
251
  else:
252
+ return gr.DownloadButton(label="Download not ready", value="output_file", interactive=False), "You need to select a converter before"
253
 
254
  except Exception as e:
255
  error_message = f"An error occurred: {str(e)}\n\nTraceback:\n{traceback.format_exc()}"