Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -25,8 +25,7 @@ def download_audio_file(url):
|
|
25 |
if file_extension not in AUDIO_FORMATS:
|
26 |
raise ValueError(f"Invalid audio file format: {file_extension}")
|
27 |
with open(file_name, "wb") as f:
|
28 |
-
|
29 |
-
f.write(chunk)
|
30 |
return file_name
|
31 |
except requests.exceptions.RequestException as e:
|
32 |
print(f"Error downloading audio file: {e}")
|
@@ -43,7 +42,7 @@ def convert_to_wav(input_audio_file):
|
|
43 |
|
44 |
def synthesize_text(text, input_audio_file, language):
|
45 |
input_audio_file = convert_to_wav(input_audio_file)
|
46 |
-
tts.tts_to_file(text=text, speaker_wav=input_audio_file, language=language, file_path="./output.wav"
|
47 |
return "./output.wav"
|
48 |
|
49 |
def clone(text, input_file, language, url=None, use_url=False):
|
|
|
25 |
if file_extension not in AUDIO_FORMATS:
|
26 |
raise ValueError(f"Invalid audio file format: {file_extension}")
|
27 |
with open(file_name, "wb") as f:
|
28 |
+
f.write(response.content) # Write the entire response content at once
|
|
|
29 |
return file_name
|
30 |
except requests.exceptions.RequestException as e:
|
31 |
print(f"Error downloading audio file: {e}")
|
|
|
42 |
|
43 |
def synthesize_text(text, input_audio_file, language):
|
44 |
input_audio_file = convert_to_wav(input_audio_file)
|
45 |
+
tts.tts_to_file(text=text, speaker_wav=input_audio_file, language=language, file_path="./output.wav")
|
46 |
return "./output.wav"
|
47 |
|
48 |
def clone(text, input_file, language, url=None, use_url=False):
|