Zeebra commited on
Commit
64b0931
1 Parent(s): 195082d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -28,8 +28,10 @@ def decipher(audio):
28
  )
29
 
30
  system_message = response["choices"][0]["message"]["content"]
31
- audio_response = gTTS(text=system_message, lang='en', slow=False)
32
- audio_response.save("response.mp3")
 
 
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, gr.outputs.Audio("response.mp3", type="audio")
42
 
43
  # Using Gradio's audio Interface
44
- interface = gr.Interface(fn=decipher, inputs=gr.Audio(source="microphone", type="file"),
45
- outputs=["text", gr.outputs.Audio("response.mp3", type="filepath")])
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()