Update app.py
Browse files
app.py
CHANGED
|
@@ -704,6 +704,12 @@ def evaluate_pronunciation():
|
|
| 704 |
best_reference = os.path.basename(ref_file)
|
| 705 |
best_transcription = ref_transcription
|
| 706 |
logger.info(f"π New best match: {best_reference} with score {best_score:.2f}%")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 707 |
except Exception as e:
|
| 708 |
logger.error(f"β Error processing reference audio {ref_file}: {str(e)}")
|
| 709 |
logger.debug(f"Stack trace: {traceback.format_exc()}")
|
|
|
|
| 704 |
best_reference = os.path.basename(ref_file)
|
| 705 |
best_transcription = ref_transcription
|
| 706 |
logger.info(f"π New best match: {best_reference} with score {best_score:.2f}%")
|
| 707 |
+
|
| 708 |
+
# Add this early exit condition here
|
| 709 |
+
if similarity > 80.0: # If we find a really good match
|
| 710 |
+
logger.info(f"π Found excellent match (>80%). Stopping evaluation early.")
|
| 711 |
+
break # Exit the loop early
|
| 712 |
+
|
| 713 |
except Exception as e:
|
| 714 |
logger.error(f"β Error processing reference audio {ref_file}: {str(e)}")
|
| 715 |
logger.debug(f"Stack trace: {traceback.format_exc()}")
|