pragnakalp commited on
Commit
bda9d28
·
verified ·
1 Parent(s): 25cfbdb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -110,7 +110,7 @@ def calculate(image_in, audio_in):
110
  image.save("image.png")
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) with open("test.json", "w") as f:
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")
 
110
  image.save("image.png")
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")