Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ from gtts import gTTS
|
|
| 3 |
import os
|
| 4 |
import tempfile
|
| 5 |
import json
|
|
|
|
| 6 |
|
| 7 |
# Store cart in a temporary storage
|
| 8 |
cart = []
|
|
@@ -31,7 +32,6 @@ def restaurant_voice_assistant(audio, state_json):
|
|
| 31 |
|
| 32 |
# Convert audio input to text
|
| 33 |
if audio:
|
| 34 |
-
import speech_recognition as sr
|
| 35 |
recognizer = sr.Recognizer()
|
| 36 |
with sr.AudioFile(audio) as source:
|
| 37 |
try:
|
|
@@ -79,7 +79,7 @@ with gr.Blocks() as demo:
|
|
| 79 |
state = gr.State(value=json.dumps({}))
|
| 80 |
|
| 81 |
with gr.Row():
|
| 82 |
-
user_audio = gr.Audio(
|
| 83 |
output_text = gr.Textbox(label="Response Text")
|
| 84 |
|
| 85 |
with gr.Row():
|
|
|
|
| 3 |
import os
|
| 4 |
import tempfile
|
| 5 |
import json
|
| 6 |
+
import speech_recognition as sr
|
| 7 |
|
| 8 |
# Store cart in a temporary storage
|
| 9 |
cart = []
|
|
|
|
| 32 |
|
| 33 |
# Convert audio input to text
|
| 34 |
if audio:
|
|
|
|
| 35 |
recognizer = sr.Recognizer()
|
| 36 |
with sr.AudioFile(audio) as source:
|
| 37 |
try:
|
|
|
|
| 79 |
state = gr.State(value=json.dumps({}))
|
| 80 |
|
| 81 |
with gr.Row():
|
| 82 |
+
user_audio = gr.Audio(type="filepath", label="Your Voice Input")
|
| 83 |
output_text = gr.Textbox(label="Response Text")
|
| 84 |
|
| 85 |
with gr.Row():
|