pragnakalp commited on
Commit
1ef6532
1 Parent(s): bda9d28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -0
app.py CHANGED
@@ -111,6 +111,7 @@ def calculate(image_in, audio_in):
111
 
112
  pocketsphinx_run = subprocess.run(['pocketsphinx', '-phone_align', 'yes', 'single', '/content/audio.wav'], check=True, capture_output=True)
113
  jq_run = subprocess.run(['jq', '[.w[]|{word: (.t | ascii_upcase | sub("<S>"; "sil") | sub("<SIL>"; "sil") | sub(r"\\\\(2\\\\)"; "") | sub(r"\\\\(3\\\\)"; "") | sub(r"\\\\(4\\\\)"; "") | sub("\\\\[SPEECH\\\\]"; "SIL") | sub("\\\\[NOISE\\\\]"; "SIL")), phones: [.w[]|{ph: .t | sub("\\\\+SPN\\\\+"; "SIL") | sub("\\\\+NSN\\\\+"; "SIL"), bg: (.b*100)|floor, ed: (.b*100+.d*100)|floor}]}]'], input=pocketsphinx_run.stdout, capture_output=True)
 
114
  f.write(jq_run.stdout.decode('utf-8').strip())
115
  # device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
116
  # os.system(f"rm -rf /content/image_audio.mp4")
 
111
 
112
  pocketsphinx_run = subprocess.run(['pocketsphinx', '-phone_align', 'yes', 'single', '/content/audio.wav'], check=True, capture_output=True)
113
  jq_run = subprocess.run(['jq', '[.w[]|{word: (.t | ascii_upcase | sub("<S>"; "sil") | sub("<SIL>"; "sil") | sub(r"\\\\(2\\\\)"; "") | sub(r"\\\\(3\\\\)"; "") | sub(r"\\\\(4\\\\)"; "") | sub("\\\\[SPEECH\\\\]"; "SIL") | sub("\\\\[NOISE\\\\]"; "SIL")), phones: [.w[]|{ph: .t | sub("\\\\+SPN\\\\+"; "SIL") | sub("\\\\+NSN\\\\+"; "SIL"), bg: (.b*100)|floor, ed: (.b*100+.d*100)|floor}]}]'], input=pocketsphinx_run.stdout, capture_output=True)
114
+ with open("test.json", "w") as f:
115
  f.write(jq_run.stdout.decode('utf-8').strip())
116
  # device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
117
  # os.system(f"rm -rf /content/image_audio.mp4")