pragnakalp commited on
Commit
ea3b369
1 Parent(s): a0cee52

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") | r"\(2\)" | r"\(3\)" | r"\(4\)" | sub("\\\[SPEECH\\\]"; "SIL") | sub("\\\[NOISE\\\]"; "SIL")), phones: [.w[]|{ph: .t | sub(r"\+SPN\+"; "SIL") | sub(r"\+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')
 
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("\\\(2\\\)"; "") | sub("\\\(3\\\)"; "") | sub("\\\(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')