Spaces:
Sleeping
Sleeping
feat: Update PDF processing to improve status updates during audio generation
Browse files
_app.py
CHANGED
|
@@ -32,8 +32,8 @@ def main():
|
|
| 32 |
try:
|
| 33 |
explanations = extractor.generate_explanations(extracted_text)
|
| 34 |
|
| 35 |
-
# Show explanations immediately, audio loading
|
| 36 |
-
yield extracted_text,
|
| 37 |
|
| 38 |
# Step 3: Generate audio
|
| 39 |
try:
|
|
@@ -53,12 +53,12 @@ def main():
|
|
| 53 |
|
| 54 |
audio_result = generate_tts_audio(clean_text, None)
|
| 55 |
|
| 56 |
-
# Show everything
|
| 57 |
-
yield extracted_text,
|
| 58 |
|
| 59 |
except Exception as audio_error:
|
| 60 |
-
# Show explanations,
|
| 61 |
-
yield extracted_text,
|
| 62 |
|
| 63 |
except Exception as explanation_error:
|
| 64 |
# Show extracted text, but indicate explanation error
|
|
|
|
| 32 |
try:
|
| 33 |
explanations = extractor.generate_explanations(extracted_text)
|
| 34 |
|
| 35 |
+
# Show explanations immediately, update status for audio loading
|
| 36 |
+
yield extracted_text, gr.update(value="Generating audio..."), explanations, None, gr.update(visible=False)
|
| 37 |
|
| 38 |
# Step 3: Generate audio
|
| 39 |
try:
|
|
|
|
| 53 |
|
| 54 |
audio_result = generate_tts_audio(clean_text, None)
|
| 55 |
|
| 56 |
+
# Show everything, update status to complete
|
| 57 |
+
yield extracted_text, gr.update(value="All steps complete!"), explanations, audio_result, gr.update(visible=True)
|
| 58 |
|
| 59 |
except Exception as audio_error:
|
| 60 |
+
# Show explanations, update status with audio error
|
| 61 |
+
yield extracted_text, gr.update(value=f"Audio generation failed: {str(audio_error)}"), explanations, None, gr.update(visible=False)
|
| 62 |
|
| 63 |
except Exception as explanation_error:
|
| 64 |
# Show extracted text, but indicate explanation error
|