bomolopuu commited on
Commit
46c2ede
·
1 Parent(s): 5d13184
Files changed (2) hide show
  1. asr.py +3 -3
  2. csv_processor.py +5 -1
asr.py CHANGED
@@ -65,8 +65,8 @@ def transcribe_multiple_files(audio_files, lang, transcription):
65
 
66
  @spaces.GPU
67
  def transcribe_file(model, audio_samples, lang, user_transcription):
68
- if not audio_samples:
69
- return "<<ERROR: Empty Audio Input>>"
70
 
71
  lang_code = lang.split()[0]
72
  processor.tokenizer.set_target_lang(lang_code)
@@ -93,7 +93,7 @@ def transcribe_file(model, audio_samples, lang, user_transcription):
93
  #model = fine_tune_model(model, processor, user_transcription, audio_samples, lang_code)
94
  #logger.debug(f"Fine-tuning the model with user-provided transcription: {user_transcription}")
95
 
96
- #return transcription
97
 
98
  @spaces.GPU
99
  def fine_tune_model(model, processor, user_transcription, audio_samples, lang_code):
 
65
 
66
  @spaces.GPU
67
  def transcribe_file(model, audio_samples, lang, user_transcription):
68
+ # if not audio_samples:
69
+ # return "<<ERROR: Empty Audio Input>>"
70
 
71
  lang_code = lang.split()[0]
72
  processor.tokenizer.set_target_lang(lang_code)
 
93
  #model = fine_tune_model(model, processor, user_transcription, audio_samples, lang_code)
94
  #logger.debug(f"Fine-tuning the model with user-provided transcription: {user_transcription}")
95
 
96
+ return transcription
97
 
98
  @spaces.GPU
99
  def fine_tune_model(model, processor, user_transcription, audio_samples, lang_code):
csv_processor.py CHANGED
@@ -12,7 +12,11 @@ def hash_md5(filepath):
12
  except Exception as e:
13
  return str(e)
14
 
15
- import csv
 
 
 
 
16
 
17
  def update_csv(file_path, search_hash, hash_16000, new_path, new_transcription):
18
  # Use read/write mode to modify the relevant line or append if not found
 
12
  except Exception as e:
13
  return str(e)
14
 
15
+
16
+ def update_csv_with_files(csv_file_path, audio_old_path, audio_16000_path, new_transcription):
17
+ hash_old = hash_md5(audio_old_path)
18
+ hash_new = hash_md5(audio_16000_path)
19
+ update_csv(csv_file_path, hash_old, hash_new)
20
 
21
  def update_csv(file_path, search_hash, hash_16000, new_path, new_transcription):
22
  # Use read/write mode to modify the relevant line or append if not found