Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -12,8 +12,6 @@ import re
|
|
12 |
import time
|
13 |
from streaming_stt_nemo import Model
|
14 |
|
15 |
-
number_to_word = inflect.engine()
|
16 |
-
|
17 |
default_lang = "en"
|
18 |
|
19 |
engines = { default_lang: Model(default_lang) }
|
@@ -48,24 +46,10 @@ def model(text):
|
|
48 |
|
49 |
return output
|
50 |
|
51 |
-
def number_to_words(str):
|
52 |
-
words = str.split(' ')
|
53 |
-
result = []
|
54 |
-
|
55 |
-
for word in words:
|
56 |
-
if( any(char.isdigit() for char in word) ):
|
57 |
-
word = number_to_word.number_to_words(word)
|
58 |
-
|
59 |
-
result.append(word)
|
60 |
-
|
61 |
-
final_result = ' '.join(result).replace('point', '')
|
62 |
-
return final_result
|
63 |
-
|
64 |
async def respond(audio):
|
65 |
user = transcribe(audio)
|
66 |
reply = model(user)
|
67 |
-
|
68 |
-
communicate = edge_tts.Communicate(reply2)
|
69 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|
70 |
tmp_path = tmp_file.name
|
71 |
await communicate.save(tmp_path)
|
|
|
12 |
import time
|
13 |
from streaming_stt_nemo import Model
|
14 |
|
|
|
|
|
15 |
default_lang = "en"
|
16 |
|
17 |
engines = { default_lang: Model(default_lang) }
|
|
|
46 |
|
47 |
return output
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
async def respond(audio):
|
50 |
user = transcribe(audio)
|
51 |
reply = model(user)
|
52 |
+
communicate = edge_tts.Communicate(reply)
|
|
|
53 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|
54 |
tmp_path = tmp_file.name
|
55 |
await communicate.save(tmp_path)
|