Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -131,7 +131,15 @@ def generate_audio_from_file(file_path, modelo_de_voz, velocidade, tom, volume):
|
|
131 |
os.makedirs(output_dir, exist_ok=True)
|
132 |
output_file = os.path.join(output_dir, "new_audio.mp3")
|
133 |
|
134 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
cmd = [
|
136 |
"edge-tts",
|
137 |
"-f", file_path, # Certificar que o conteúdo do arquivo seja texto puro
|
|
|
131 |
os.makedirs(output_dir, exist_ok=True)
|
132 |
output_file = os.path.join(output_dir, "new_audio.mp3")
|
133 |
|
134 |
+
# Limpa o arquivo existente antes de gerar novo áudio
|
135 |
+
if os.path.exists(output_file):
|
136 |
+
try:
|
137 |
+
os.remove(output_file)
|
138 |
+
print(f"Arquivo anterior {output_file} removido com sucesso.")
|
139 |
+
except Exception as e:
|
140 |
+
print(f"Erro ao remover arquivo existente: {e}")
|
141 |
+
return None
|
142 |
+
|
143 |
cmd = [
|
144 |
"edge-tts",
|
145 |
"-f", file_path, # Certificar que o conteúdo do arquivo seja texto puro
|