Spaces:
Runtime error
Runtime error
Commit ·
2cf5541
1
Parent(s): b30324c
error handling
Browse files
app.py
CHANGED
|
@@ -10,12 +10,15 @@ def request_to_asr_service(audiofile):
|
|
| 10 |
|
| 11 |
# file_path = "/media/mohammadkrb/hddExt/personal_projects/vidabia/audio_tests/epit_sample.mp3"
|
| 12 |
# file_data = open(file_path, 'rb')
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
response = requests.post(ASR_API, files=files)
|
| 17 |
-
return response.json()
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
st.set_page_config(
|
| 20 |
page_title="Automatic Speech Recognition",
|
| 21 |
page_icon="🗣",
|
|
|
|
| 10 |
|
| 11 |
# file_path = "/media/mohammadkrb/hddExt/personal_projects/vidabia/audio_tests/epit_sample.mp3"
|
| 12 |
# file_data = open(file_path, 'rb')
|
| 13 |
+
try:
|
| 14 |
|
| 15 |
+
files = {'file': (audiofile)}
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
response = requests.post(ASR_API, files=files)
|
| 18 |
+
return response.json()
|
| 19 |
+
except:
|
| 20 |
+
st.info('ASR Service not worked!')
|
| 21 |
+
|
| 22 |
st.set_page_config(
|
| 23 |
page_title="Automatic Speech Recognition",
|
| 24 |
page_icon="🗣",
|