avinash commited on
Commit
a50f676
Β·
1 Parent(s): 0a81205
Files changed (1) hide show
  1. app.py +28 -7
app.py CHANGED
@@ -1,13 +1,34 @@
1
  import gradio as gr
 
 
 
2
 
3
- with gr.Blocks(fill_height=True) as demo:
4
- with gr.Sidebar():
5
- gr.Markdown("# Inference Provider")
6
- gr.Markdown("This Space showcases the nari-labs/Dia-1.6B model, served by the fal-ai API. Sign in with your Hugging Face account to use this API.")
7
- button = gr.LoginButton("Sign in")
8
- gr.load("models/nari-labs/Dia-1.6B", accept_token=button, provider="fal-ai")
9
 
 
 
 
 
 
 
 
 
 
 
10
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  if __name__ == "__main__":
13
- demo.launch()
 
1
  import gradio as gr
2
+ from asr import transcribe_audio
3
+ from llm_agent import get_llm_reply
4
+ from tts import generate_speech
5
 
6
+ def voice_agent(audio):
7
+ if audio is None:
8
+ return "No audio received!", "...", None
 
 
 
9
 
10
+ # ASR
11
+ user_text = transcribe_audio(audio)
12
+
13
+ # LLM
14
+ bot_reply = get_llm_reply(user_text)
15
+
16
+ # TTS
17
+ audio_reply = generate_speech(bot_reply)
18
+
19
+ return user_text, bot_reply, audio_reply
20
 
21
+ ui = gr.Interface(
22
+ fn=voice_agent,
23
+ inputs=gr.Audio(type="filepath", label="πŸŽ™οΈ Upload Voice (.wav or .mp3)"),
24
+ outputs=[
25
+ gr.Textbox(label="πŸ“ Transcribed Text"),
26
+ gr.Textbox(label="πŸ€– LLM Reply"),
27
+ gr.Audio(type="filepath", label="πŸ”Š AI Voice Response")
28
+ ],
29
+ title="VoiceFreight AI v1.0",
30
+ description="Upload a voice file. Get a spoken reply from an AI freight agent!"
31
+ )
32
 
33
  if __name__ == "__main__":
34
+ ui.launch()