Mendoza33 commited on
Commit
1b48e7b
·
verified ·
1 Parent(s): ce12c26

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -4,7 +4,9 @@ import gradio as gr
4
  # Load pre-trained models
5
  stt_model = pipeline("automatic-speech-recognition", model="openai/whisper-tiny")
6
  nlp_model = pipeline("text-generation", model="sshleifer/tiny-gpt2")
7
- tts_model = pipeline("text-to-speech", model="coqui/XTTS-v2")
 
 
8
 
9
  # Define a function to handle the workflow
10
  def conversation(audio):
@@ -19,10 +21,10 @@ def conversation(audio):
19
  # Default response generation (using GPT-2 model)
20
  response = nlp_model(text, max_length=50)[0]["generated_text"]
21
 
22
- # Step 3: Convert response text to speech using XTTS-v2
23
- audio_response = tts_model(response)
24
 
25
- return text, response, audio_response
26
 
27
  # Create Gradio Interface
28
  interface = gr.Interface(
 
4
  # Load pre-trained models
5
  stt_model = pipeline("automatic-speech-recognition", model="openai/whisper-tiny")
6
  nlp_model = pipeline("text-generation", model="sshleifer/tiny-gpt2")
7
+
8
+ # Attempt to load Kokoro-82M for TTS (this might require adjustments depending on model support)
9
+ tts_model = pipeline("text-to-speech", model="hexgrad/Kokoro-82M")
10
 
11
  # Define a function to handle the workflow
12
  def conversation(audio):
 
21
  # Default response generation (using GPT-2 model)
22
  response = nlp_model(text, max_length=50)[0]["generated_text"]
23
 
24
+ # Step 3: Convert response text to speech using Kokoro-82M
25
+ tts_audio = tts_model(response)
26
 
27
+ return text, response, tts_audio
28
 
29
  # Create Gradio Interface
30
  interface = gr.Interface(