pragnakalp
commited on
Commit
•
562fd04
1
Parent(s):
be07b61
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") | 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')
|