balaramas commited on
Commit
782ad98
1 Parent(s): ef8b63e

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -83,18 +83,24 @@ def run_my_code(input_text, language):
83
 
84
  os.system(f"cp {hi_wav} {data_root}data/tst-COMMON/wav/test.wav")
85
 
86
- print("------Starting data prepration...")
87
  subprocess.run(["python", "prep_mustc_data_hindi_single.py", "--data-root", d_r, "--task", "st", "--vocab-type", "unigram", "--vocab-size", "8000"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
88
 
89
- print("------Performing translation...")
90
 
91
  translation_result = subprocess.run(["python", "generate.py", data_root, "--config-yaml", "config_st.yaml", "--gen-subset", "tst-COMMON_st", "--task", "speech_to_text", "--path", model_checkpoint], capture_output=True, text=True)
92
  translation_result_text = translation_result.stdout
93
 
94
  lines = translation_result_text.split("\n")
95
 
 
 
 
 
 
 
96
  output_text=""
97
- print("\n\n------Translation results are:")
98
  for i in lines:
99
  if (i.startswith("D-0")):
100
  print(i.split("\t")[2])
 
83
 
84
  os.system(f"cp {hi_wav} {data_root}data/tst-COMMON/wav/test.wav")
85
 
86
+ print("------Starting data prepration------")
87
  subprocess.run(["python", "prep_mustc_data_hindi_single.py", "--data-root", d_r, "--task", "st", "--vocab-type", "unigram", "--vocab-size", "8000"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
88
 
89
+ print("------Performing translation------")
90
 
91
  translation_result = subprocess.run(["python", "generate.py", data_root, "--config-yaml", "config_st.yaml", "--gen-subset", "tst-COMMON_st", "--task", "speech_to_text", "--path", model_checkpoint], capture_output=True, text=True)
92
  translation_result_text = translation_result.stdout
93
 
94
  lines = translation_result_text.split("\n")
95
 
96
+
97
+ #just for checking the duration from the yaml file of the current input audio
98
+ with open(yam, 'r') as yaml_file:
99
+ data = yaml.safe_load(yaml_file)
100
+ print(data[0]['duration'], " seconds duration")
101
+
102
  output_text=""
103
+ print("\n\n------Translation results are:\n")
104
  for i in lines:
105
  if (i.startswith("D-0")):
106
  print(i.split("\t")[2])