Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -293,7 +293,13 @@ def process_files(
|
|
| 293 |
zipf.write(csv_path, arcname="metrics.csv")
|
| 294 |
|
| 295 |
zipf.close()
|
| 296 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 297 |
|
| 298 |
# Gradio UI
|
| 299 |
|
|
@@ -313,6 +319,8 @@ with gr.Blocks() as demo:
|
|
| 313 |
|
| 314 |
output_zip = gr.File(label="Download ZIP of Enhanced Audio and Reports")
|
| 315 |
|
|
|
|
|
|
|
| 316 |
progress_bar = gr.Label(value="Upload files and select enhancement options.")
|
| 317 |
|
| 318 |
def run_enhancement(files, nr, vi, reverb, vol, lang):
|
|
@@ -321,14 +329,14 @@ with gr.Blocks() as demo:
|
|
| 321 |
|
| 322 |
if not (nr or vi or reverb or vol or lang):
|
| 323 |
return None, "⚠️ Please enable at least one enhancement option."
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
return
|
| 327 |
|
| 328 |
enhance_btn.click(
|
| 329 |
fn=run_enhancement,
|
| 330 |
inputs=[audio_files, noise_checkbox, voice_iso_checkbox, reverb_checkbox, volume_checkbox, lang_checkbox],
|
| 331 |
-
outputs=[output_zip, progress_bar],
|
| 332 |
show_progress=True,
|
| 333 |
)
|
| 334 |
|
|
|
|
| 293 |
zipf.write(csv_path, arcname="metrics.csv")
|
| 294 |
|
| 295 |
zipf.close()
|
| 296 |
+
first_enhanced_audio = None
|
| 297 |
+
if metrics:
|
| 298 |
+
first_file = metrics[0]["file"]
|
| 299 |
+
first_enhanced_filename = os.path.splitext(first_file)[0] + "_enhanced.wav"
|
| 300 |
+
first_enhanced_audio = os.path.join(temp_dir, first_enhanced_filename)
|
| 301 |
+
|
| 302 |
+
return zip_path, first_enhanced_audio
|
| 303 |
|
| 304 |
# Gradio UI
|
| 305 |
|
|
|
|
| 319 |
|
| 320 |
output_zip = gr.File(label="Download ZIP of Enhanced Audio and Reports")
|
| 321 |
|
| 322 |
+
enhanced_audio_preview = gr.Audio(label="Preview First Enhanced Audio", interactive=False)
|
| 323 |
+
|
| 324 |
progress_bar = gr.Label(value="Upload files and select enhancement options.")
|
| 325 |
|
| 326 |
def run_enhancement(files, nr, vi, reverb, vol, lang):
|
|
|
|
| 329 |
|
| 330 |
if not (nr or vi or reverb or vol or lang):
|
| 331 |
return None, "⚠️ Please enable at least one enhancement option."
|
| 332 |
+
|
| 333 |
+
zip_path, audio_path = process_files(files, nr, vi, reverb, vol, lang)
|
| 334 |
+
return zip_path, audio_path, "✅ Processing complete. Download your ZIP file below."
|
| 335 |
|
| 336 |
enhance_btn.click(
|
| 337 |
fn=run_enhancement,
|
| 338 |
inputs=[audio_files, noise_checkbox, voice_iso_checkbox, reverb_checkbox, volume_checkbox, lang_checkbox],
|
| 339 |
+
outputs=[output_zip, enhanced_audio_preview, progress_bar],
|
| 340 |
show_progress=True,
|
| 341 |
)
|
| 342 |
|