Mod: Update error msg when audio file is too short or too long.
Browse files
app.py
CHANGED
@@ -72,11 +72,17 @@ def get_results(
|
|
72 |
duration = metadata.num_frames / metadata.sample_rate
|
73 |
|
74 |
if MIN_AUDIO_DURATION_SEC > duration:
|
75 |
-
error_msg = f"
|
|
|
|
|
|
|
76 |
st.session_state[result_hash] = error_msg
|
77 |
|
78 |
elif duration > MAX_AUDIO_DURATION_SEC:
|
79 |
-
error_msg = f"
|
|
|
|
|
|
|
80 |
st.session_state[result_hash] = error_msg
|
81 |
|
82 |
else:
|
|
|
72 |
duration = metadata.num_frames / metadata.sample_rate
|
73 |
|
74 |
if MIN_AUDIO_DURATION_SEC > duration:
|
75 |
+
error_msg = f"""
|
76 |
+
##### Result for "{audio_fname}"
|
77 |
+
Audio file is too short. (found {duration:.2f}s but the model expect audio in range [{MIN_AUDIO_DURATION_SEC}, {MAX_AUDIO_DURATION_SEC}])
|
78 |
+
"""
|
79 |
st.session_state[result_hash] = error_msg
|
80 |
|
81 |
elif duration > MAX_AUDIO_DURATION_SEC:
|
82 |
+
error_msg = f"""
|
83 |
+
##### Result for "{audio_fname}"
|
84 |
+
Audio file is too long. (found {duration:.2f}s but the model expect audio in range [{MIN_AUDIO_DURATION_SEC}, {MAX_AUDIO_DURATION_SEC}])
|
85 |
+
"""
|
86 |
st.session_state[result_hash] = error_msg
|
87 |
|
88 |
else:
|