Update app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,6 @@ def convert_mp4_to_wav(mp4_file):
|
|
| 11 |
"""
|
| 12 |
Extracts the audio track from an MP4 file and saves it as a WAV file.
|
| 13 |
"""
|
| 14 |
-
# Create a temporary file for the WAV audio
|
| 15 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as wav_temp:
|
| 16 |
wav_filename = wav_temp.name
|
| 17 |
|
|
@@ -33,8 +32,9 @@ def text_to_speech_with_voice(text, voice_sample):
|
|
| 33 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as fp:
|
| 34 |
output_file = fp.name
|
| 35 |
|
| 36 |
-
# Generate speech using the voice sample for speaker conditioning
|
| 37 |
-
|
|
|
|
| 38 |
return output_file
|
| 39 |
|
| 40 |
# Create the Gradio interface with a textbox and an audio uploader.
|
|
|
|
| 11 |
"""
|
| 12 |
Extracts the audio track from an MP4 file and saves it as a WAV file.
|
| 13 |
"""
|
|
|
|
| 14 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as wav_temp:
|
| 15 |
wav_filename = wav_temp.name
|
| 16 |
|
|
|
|
| 32 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as fp:
|
| 33 |
output_file = fp.name
|
| 34 |
|
| 35 |
+
# Generate speech using the voice sample for speaker conditioning,
|
| 36 |
+
# while specifying the language as Hindi ("hi") for multi-lingual support.
|
| 37 |
+
tts.tts_to_file(text=text, speaker_wav=voice_sample, file_path=output_file, language="hi")
|
| 38 |
return output_file
|
| 39 |
|
| 40 |
# Create the Gradio interface with a textbox and an audio uploader.
|