mgokg commited on
Commit
e218c4e
·
verified ·
1 Parent(s): 30b0477

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -7,7 +7,7 @@ from transformers import pipeline
7
  device = "cuda" if torch.cuda.is_available() else "cpu"
8
 
9
  speech_to_text = pipeline("automatic-speech-recognition", model="openai/whisper-large-v3-turbo", device=device)
10
- text_to_speech = pipeline("text-to-speech", model="facebook/seamless-streaming", device=device)
11
 
12
  def audio_to_audio_chatbot(audio):
13
  if audio is None:
@@ -22,14 +22,15 @@ def audio_to_audio_chatbot(audio):
22
  print(f"Bot: {response_text}")
23
 
24
  # 3. Text-to-Speech
25
- speech = text_to_speech(response_text)
26
- return speech["audio"], response_text
27
 
28
  if __name__ == "__main__":
29
  iface = gr.Interface(
30
  fn=audio_to_audio_chatbot,
31
  inputs=gr.Audio(source="microphone", type="filepath"),
32
- outputs=[gr.Audio(), gr.Textbox()],
 
33
  title="Audio-zu-Audio-Chatbot (Streaming)",
34
  description="Spreche in das Mikrofon und der Bot antwortet mit einer Audio-Ausgabe.",
35
  live=True # Aktiviert Streaming
 
7
  device = "cuda" if torch.cuda.is_available() else "cpu"
8
 
9
  speech_to_text = pipeline("automatic-speech-recognition", model="openai/whisper-large-v3-turbo", device=device)
10
+ #text_to_speech = pipeline("text-to-speech", model="facebook/seamless-streaming", device=device)
11
 
12
  def audio_to_audio_chatbot(audio):
13
  if audio is None:
 
22
  print(f"Bot: {response_text}")
23
 
24
  # 3. Text-to-Speech
25
+ #speech = text_to_speech(response_text)
26
+ #return speech["audio"], response_text
27
 
28
  if __name__ == "__main__":
29
  iface = gr.Interface(
30
  fn=audio_to_audio_chatbot,
31
  inputs=gr.Audio(source="microphone", type="filepath"),
32
+ outputs= gr.Textbox(),
33
+ #outputs=[gr.Audio(), gr.Textbox()],
34
  title="Audio-zu-Audio-Chatbot (Streaming)",
35
  description="Spreche in das Mikrofon und der Bot antwortet mit einer Audio-Ausgabe.",
36
  live=True # Aktiviert Streaming