Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -164,18 +164,18 @@ def generate_audio(docx_file, speaker_label):
|
|
| 164 |
except Exception as e:
|
| 165 |
print("Generation interrupted. Saving partial output.", e)
|
| 166 |
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
|
| 175 |
-
|
| 176 |
-
|
| 177 |
|
| 178 |
-
|
| 179 |
|
| 180 |
# --- UI ---
|
| 181 |
speaker_choices = list_speaker_choices()
|
|
|
|
| 164 |
except Exception as e:
|
| 165 |
print("Generation interrupted. Saving partial output.", e)
|
| 166 |
|
| 167 |
+
output_dir = tempfile.mkdtemp()
|
| 168 |
+
final_output_path = os.path.join(output_dir, "final_output.wav")
|
| 169 |
+
combined_audio.export(final_output_path, format="wav")
|
| 170 |
|
| 171 |
+
zip_path = os.path.join(output_dir, "output.zip")
|
| 172 |
+
with zipfile.ZipFile(zip_path, 'w') as zipf:
|
| 173 |
+
zipf.write(final_output_path, arcname="final_output.wav")
|
| 174 |
|
| 175 |
+
for f in temp_files:
|
| 176 |
+
os.remove(f)
|
| 177 |
|
| 178 |
+
return zip_path
|
| 179 |
|
| 180 |
# --- UI ---
|
| 181 |
speaker_choices = list_speaker_choices()
|