Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -618,7 +618,10 @@ Write a detailed and complete response that answers the following user question:
|
|
618 |
def transcribe(audio_file):
|
619 |
print(f"Received audio file: {audio_file}")
|
620 |
if audio_file is None:
|
621 |
-
return "No audio
|
|
|
|
|
|
|
622 |
|
623 |
try:
|
624 |
with open(audio_file, "rb") as f:
|
@@ -728,7 +731,7 @@ with gr.Blocks() as demo:
|
|
728 |
)
|
729 |
submit_button = gr.Button("Submit")
|
730 |
|
731 |
-
with gr.Accordion("⚙️ Parameters", open=
|
732 |
model = gr.Dropdown(choices=MODELS, label="Select Model", value=MODELS[3])
|
733 |
temperature = gr.Slider(minimum=0.1, maximum=1.0, value=0.2, step=0.1, label="Temperature")
|
734 |
num_calls = gr.Slider(minimum=1, maximum=5, value=1, step=1, label="Number of API Calls")
|
@@ -746,12 +749,11 @@ with gr.Blocks() as demo:
|
|
746 |
update_output = gr.Textbox(label="Update Status")
|
747 |
delete_button = gr.Button("Delete Selected Documents")
|
748 |
|
749 |
-
# Connect components
|
750 |
transcribe_button.click(
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
|
756 |
submit_button.click(
|
757 |
respond,
|
|
|
618 |
def transcribe(audio_file):
|
619 |
print(f"Received audio file: {audio_file}")
|
620 |
if audio_file is None:
|
621 |
+
return "No audio recorded. Please speak into the microphone and try again."
|
622 |
+
|
623 |
+
if not os.path.exists(audio_file):
|
624 |
+
return f"Audio file not found at path: {audio_file}"
|
625 |
|
626 |
try:
|
627 |
with open(audio_file, "rb") as f:
|
|
|
731 |
)
|
732 |
submit_button = gr.Button("Submit")
|
733 |
|
734 |
+
with gr.Accordion("⚙️ Parameters", open=True):
|
735 |
model = gr.Dropdown(choices=MODELS, label="Select Model", value=MODELS[3])
|
736 |
temperature = gr.Slider(minimum=0.1, maximum=1.0, value=0.2, step=0.1, label="Temperature")
|
737 |
num_calls = gr.Slider(minimum=1, maximum=5, value=1, step=1, label="Number of API Calls")
|
|
|
749 |
update_output = gr.Textbox(label="Update Status")
|
750 |
delete_button = gr.Button("Delete Selected Documents")
|
751 |
|
|
|
752 |
transcribe_button.click(
|
753 |
+
transcribe,
|
754 |
+
inputs=[audio_input],
|
755 |
+
outputs=[query_textbox]
|
756 |
+
)
|
757 |
|
758 |
submit_button.click(
|
759 |
respond,
|