Spaces:
Sleeping
Sleeping
File size: 776 Bytes
936a763 d27c991 936a763 d27c991 936a763 d27c991 936a763 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import gradio as gr
from stt import speech_to_text
from llm import ask_llm
from tts import text_to_speech
def voice_to_voice(audio):
if audio is None:
return "Please record audio first", "", None
user_text = speech_to_text(audio)
if user_text.strip() == "":
return "Could not recognize speech", "", None
ai_text = ask_llm(user_text)
ai_audio = text_to_speech(ai_text)
return user_text, ai_text, ai_audio
demo = gr.Interface(
fn=voice_to_voice,
inputs=gr.Audio(type="filepath", label="🎤 Speak"),
outputs=[
gr.Textbox(label="🧾 You said"),
gr.Textbox(label="🤖 AI replied"),
gr.Audio(label="🔊 AI Voice"),
],
title="🎤 Voice-to-Voice AI (Free & Open Source)",
)
demo.launch()
|