Update app.py
Browse files
app.py
CHANGED
@@ -44,21 +44,6 @@ def isolate_audio(audio_file):
|
|
44 |
for chunk in isolated_audio_iterator:
|
45 |
output_file.write(chunk)
|
46 |
|
47 |
-
# Copy the output file to a location that Gradio can access
|
48 |
-
gradio_output_path = "audio_sin_ruido.mp3"
|
49 |
-
shutil.copy2(output_file_path, gradio_output_path)
|
50 |
-
|
51 |
-
return gradio_output_path, gradio_output_path, "Ruido de fondo eliminado con éxito"
|
52 |
-
except ApiError as e:
|
53 |
-
error_message = f"API Error: {e.body['detail']['message']}"
|
54 |
-
return None, None, error_message
|
55 |
-
except Exception as e:
|
56 |
-
error_message = f"An unexpected error occurred: {str(e)}"
|
57 |
-
return None, None, error_message
|
58 |
-
finally:
|
59 |
-
# Clean up temporary files
|
60 |
-
shutil.rmtree(temp_dir, ignore_errors=True)
|
61 |
-
|
62 |
# Create Gradio interface
|
63 |
iface = gr.Interface(
|
64 |
fn=isolate_audio,
|
|
|
44 |
for chunk in isolated_audio_iterator:
|
45 |
output_file.write(chunk)
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
# Create Gradio interface
|
48 |
iface = gr.Interface(
|
49 |
fn=isolate_audio,
|