Shrirang20 commited on
Commit
516eb9f
1 Parent(s): cfc8c11

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -309,7 +309,6 @@ def run_tts(text, tts_lang):
309
 
310
  os.system(tts_command)
311
 
312
- os.makedirs('asr_models', exist_ok=True)
313
 
314
  def download_ai4b_asr_model(lang: str):
315
 
@@ -326,7 +325,10 @@ def download_ai4b_asr_model(lang: str):
326
  "malayalam": "ml",
327
  }
328
 
329
- download_path = f"/asr_models/ai4b_indicConformer_{available_langs[lang]}.nemo"
 
 
 
330
  print(f"Downloaded ASR model path: {download_path}")
331
 
332
  if os.path.exists(download_path):
@@ -336,8 +338,14 @@ def download_ai4b_asr_model(lang: str):
336
  raise ValueError(f"Invalid language code: {lang}")
337
  else:
338
  url = f"https://objectstore.e2enetworks.net/indic-asr-public/indicConformer/ai4b_indicConformer_{available_langs[lang]}.nemo"
339
- subprocess.run(['wget', url, '-O', download_path], check=True)
340
-
 
 
 
 
 
 
341
 
342
  return download_path
343
 
 
309
 
310
  os.system(tts_command)
311
 
 
312
 
313
  def download_ai4b_asr_model(lang: str):
314
 
 
325
  "malayalam": "ml",
326
  }
327
 
328
+ os.makedirs('asr_models', exist_ok=True)
329
+ # download_path = f"/asr_models/ai4b_indicConformer_{available_langs[lang]}.nemo"
330
+ download_dir = "asr_models"
331
+ download_path = os.path.join(download_dir,f"ai4b_indicConformer_{available_langs[lang]}.nemo")
332
  print(f"Downloaded ASR model path: {download_path}")
333
 
334
  if os.path.exists(download_path):
 
338
  raise ValueError(f"Invalid language code: {lang}")
339
  else:
340
  url = f"https://objectstore.e2enetworks.net/indic-asr-public/indicConformer/ai4b_indicConformer_{available_langs[lang]}.nemo"
341
+ try:
342
+ result= subprocess.run(['wget', url, '-O', download_path], check=True, capture_output=True, text=True)
343
+ print(result.stdout)
344
+ except subprocess.CallProcessError as e:
345
+ print(f"Error occured: {e.stderr}")
346
+ raise
347
+
348
+ os.makedirs('asr_models', exist_ok=True)
349
 
350
  return download_path
351