Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import gradio as gr
|
|
| 4 |
import os
|
| 5 |
|
| 6 |
def send_audio_to_laravel(audio):
|
| 7 |
-
url = os.getenv("BASE_URL")
|
| 8 |
|
| 9 |
# Save audio to a temporary file
|
| 10 |
temp_audio_path = "temp_audio.wav"
|
|
@@ -19,15 +19,16 @@ def send_audio_to_laravel(audio):
|
|
| 19 |
}
|
| 20 |
|
| 21 |
response = requests.post(url, files=files, data=data)
|
|
|
|
| 22 |
return response.json()
|
| 23 |
|
| 24 |
# Gradio interface for recording speech
|
| 25 |
iface = gr.Interface(
|
| 26 |
fn=send_audio_to_laravel,
|
| 27 |
-
inputs=gr.Audio(
|
| 28 |
outputs="text",
|
| 29 |
title="Speech Translation",
|
| 30 |
-
description="Record speech and send
|
| 31 |
)
|
| 32 |
|
| 33 |
iface.launch()
|
|
|
|
| 4 |
import os
|
| 5 |
|
| 6 |
def send_audio_to_laravel(audio):
|
| 7 |
+
url = os.getenv("BASE_URL")
|
| 8 |
|
| 9 |
# Save audio to a temporary file
|
| 10 |
temp_audio_path = "temp_audio.wav"
|
|
|
|
| 19 |
}
|
| 20 |
|
| 21 |
response = requests.post(url, files=files, data=data)
|
| 22 |
+
|
| 23 |
return response.json()
|
| 24 |
|
| 25 |
# Gradio interface for recording speech
|
| 26 |
iface = gr.Interface(
|
| 27 |
fn=send_audio_to_laravel,
|
| 28 |
+
inputs=gr.Audio(type="file"), # Removed 'source' parameter
|
| 29 |
outputs="text",
|
| 30 |
title="Speech Translation",
|
| 31 |
+
description="Record speech and send for processing"
|
| 32 |
)
|
| 33 |
|
| 34 |
iface.launch()
|