Update app.py
Browse files
app.py
CHANGED
@@ -28,8 +28,10 @@ def decipher(audio):
|
|
28 |
)
|
29 |
|
30 |
system_message = response["choices"][0]["message"]["content"]
|
31 |
-
|
32 |
-
|
|
|
|
|
33 |
|
34 |
messages.append({"role": "assistant", "content": system_message})
|
35 |
|
@@ -38,11 +40,9 @@ def decipher(audio):
|
|
38 |
if message['role'] != 'system':
|
39 |
chat_transcript += message['role'] + ": " + message['content'] + "\n\n"
|
40 |
|
41 |
-
return chat_transcript
|
42 |
|
43 |
# Using Gradio's audio Interface
|
44 |
-
interface = gr.Interface(fn=decipher, inputs=gr.Audio(
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
interface.launch()
|
|
|
28 |
)
|
29 |
|
30 |
system_message = response["choices"][0]["message"]["content"]
|
31 |
+
myobj = gTTS(text=system_message, lang='en', slow=False)
|
32 |
+
myobj.save("welcome.mp3")
|
33 |
+
# Playing the converted file
|
34 |
+
os.system("xdg-open welcome.mp3")
|
35 |
|
36 |
messages.append({"role": "assistant", "content": system_message})
|
37 |
|
|
|
40 |
if message['role'] != 'system':
|
41 |
chat_transcript += message['role'] + ": " + message['content'] + "\n\n"
|
42 |
|
43 |
+
return chat_transcript
|
44 |
|
45 |
# Using Gradio's audio Interface
|
46 |
+
interface = gr.Interface(fn=decipher, inputs=gr.Audio(
|
47 |
+
source="microphone", type="filepath"), outputs="text")
|
|
|
|
|
48 |
interface.launch()
|