karlhajal commited on
Commit
2394567
·
verified ·
1 Parent(s): 4578f82

Update parse_tsv method

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -227,7 +227,7 @@ def check_pronunciation_demo(reference_audio, input_audio, labels_data, threshol
227
  def parse_tsv(file_path):
228
  transcriptions = []
229
 
230
- num_to_subtract = float('inf')
231
 
232
  if os.path.exists(file_path):
233
  with open(file_path, "r", encoding="utf-8") as f:
@@ -235,12 +235,15 @@ def parse_tsv(file_path):
235
  for row in reader:
236
  if len(row) == 4: # Ensure it has the expected 4 columns
237
  start, end, latin, arabic = row
238
- start = float(start)/1000.
239
- end = float(end)/1000.
240
-
241
- num_to_subtract = min(num_to_subtract, start)
242
  start -= num_to_subtract
243
  end -= num_to_subtract
 
 
 
244
 
245
  transcriptions.append((start, end, latin, arabic))
246
  return transcriptions
 
227
  def parse_tsv(file_path):
228
  transcriptions = []
229
 
230
+ num_to_subtract = None
231
 
232
  if os.path.exists(file_path):
233
  with open(file_path, "r", encoding="utf-8") as f:
 
235
  for row in reader:
236
  if len(row) == 4: # Ensure it has the expected 4 columns
237
  start, end, latin, arabic = row
238
+ start = int(start)
239
+ end = int(end)
240
+ if num_to_subtract is None:
241
+ num_to_subtract = start
242
  start -= num_to_subtract
243
  end -= num_to_subtract
244
+
245
+ start = float(start)/1000.
246
+ end = float(end)/1000.
247
 
248
  transcriptions.append((start, end, latin, arabic))
249
  return transcriptions