Dinoking commited on
Commit
5e9c08a
·
verified ·
1 Parent(s): cc77ee4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -5,13 +5,14 @@ from transformers import pipeline
5
 
6
  # Load models
7
  asr = pipeline("automatic-speech-recognition", model="openai/whisper-small")
8
- tts = pipeline("text-to-speech", model="facebook/mms-tts-eng")
9
 
10
  def speech_to_speech(audio):
11
  # Speech → Text
12
- text = asr(audio)["text"]
 
13
 
14
- # Text → Speech
15
  speech = tts(text)
16
 
17
  # Save audio
@@ -24,10 +25,10 @@ demo = gr.Interface(
24
  inputs=gr.Audio(type="filepath", label="Speak here"),
25
  outputs=[
26
  gr.Textbox(label="Recognized Text"),
27
- gr.Audio(label="Generated Speech")
28
  ],
29
- title="Speech to Speech AI",
30
- description="Speak into the mic, AI listens and speaks back"
31
  )
32
 
33
  demo.launch()
 
5
 
6
  # Load models
7
  asr = pipeline("automatic-speech-recognition", model="openai/whisper-small")
8
+ tts = pipeline("text-to-speech", model="facebook/mms-tts-hin")
9
 
10
  def speech_to_speech(audio):
11
  # Speech → Text
12
+ result = asr(audio)
13
+ text = result["text"]
14
 
15
+ # Text → Speech (Hindi voice)
16
  speech = tts(text)
17
 
18
  # Save audio
 
25
  inputs=gr.Audio(type="filepath", label="Speak here"),
26
  outputs=[
27
  gr.Textbox(label="Recognized Text"),
28
+ gr.Audio(label="Hindi Speech Output")
29
  ],
30
+ title="Speech to Speech AI (Hindi)",
31
+ description="Speak into the mic, AI listens and replies in Hindi voice"
32
  )
33
 
34
  demo.launch()