Bisher commited on
Commit
33b395c
·
verified ·
1 Parent(s): adaae60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -14
app.py CHANGED
@@ -289,17 +289,4 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
289
  outputs=[transcript_output, wer_output, der_output] # Update transcript and metrics
290
  )
291
 
292
- # --- Launch the App ---
293
- if __name__ == "__main__":
294
- app.launch(debug=True) # Set debug=False for production
295
- ```
296
-
297
- **Key Changes:**
298
-
299
- 1. **`diacritize_text_api` Return Value:** Modified all `return` statements in `diacritize_text_api` to return the result (or error message) twice as a tuple (e.g., `return result_str, result_str`).
300
- 2. **Error Handling:** Added checks for empty/invalid inputs and outputs in various functions to prevent downstream errors and provide clearer messages. Ensured API results and transcripts are handled as strings.
301
- 3. **Metric Calculation Robustness:** Added checks for string types and empty strings within `calculate_metrics` and handled edge cases for DER calculation with empty character lists.
302
- 4. **`process_audio_and_compare` Robustness:** Added checks to ensure `original_diacritized_text` is valid before proceeding and handled potential `None` returns from `calculate_metrics`.
303
- 5. **Gradio Components:** Explicitly set `precision=4` for the `gr.Number` outputs for WER and DER for consistent formatting.
304
-
305
- This version should now correctly handle the outputs for the state and the textbox, resolving the `ValueErro
 
289
  outputs=[transcript_output, wer_output, der_output] # Update transcript and metrics
290
  )
291
 
292
+ app.launch(debug=True, share=True)