pragnakalp
commited on
Commit
•
ea3b369
1
Parent(s):
a0cee52
Update app.py
Browse files
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") |
|
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')
|