Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,17 +40,20 @@ def voice_assistant(audio_file):
|
|
| 40 |
with gr.Blocks() as demo:
|
| 41 |
gr.HTML("<h1 style='text-align: center; color: #333;'>🎤 Voice Assistant</h1>")
|
| 42 |
|
| 43 |
-
# Voice Assistant Section
|
| 44 |
with gr.Row():
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
-
# Link the
|
| 54 |
-
|
| 55 |
|
| 56 |
demo.launch()
|
|
|
|
| 40 |
with gr.Blocks() as demo:
|
| 41 |
gr.HTML("<h1 style='text-align: center; color: #333;'>🎤 Voice Assistant</h1>")
|
| 42 |
|
|
|
|
| 43 |
with gr.Row():
|
| 44 |
+
# Microphone icon to prompt users to speak
|
| 45 |
+
gr.HTML(f"""
|
| 46 |
+
<div style="text-align: center;">
|
| 47 |
+
<img src="/mnt/data/Screenshot 2024-12-28 101858.jpg" alt="Microphone"
|
| 48 |
+
style="cursor: pointer; width: 50px; height: 50px;"
|
| 49 |
+
onclick="document.getElementById('audio-input').click()">
|
| 50 |
+
<p>Click the microphone to speak</p>
|
| 51 |
+
</div>
|
| 52 |
+
""")
|
| 53 |
+
mic_input = gr.Audio(id="audio-input", type="filepath", label="Record Your Query")
|
| 54 |
+
response_output = gr.Audio(type="filepath", label="Response")
|
| 55 |
|
| 56 |
+
# Link the audio input to the voice assistant function
|
| 57 |
+
mic_input.change(voice_assistant, inputs=[mic_input], outputs=[response_output])
|
| 58 |
|
| 59 |
demo.launch()
|