KiranRand commited on
Commit
774ebda
·
verified ·
1 Parent(s): cf0a8b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -5,12 +5,12 @@ import os
5
  # Load the voice cloning model
6
  tts = TTS("tts_models/multilingual/multi-dataset/your_tts").to("cpu")
7
 
8
- def generate_cloned_voice(text, reference_audio):
9
  output_path = "output.wav"
10
-
11
- # Generate cloned speech
12
- tts.tts_to_file(text=text, speaker_wav=reference_audio, file_path=output_path)
13
-
14
  return output_path
15
 
16
  # Create the Gradio interface
@@ -18,11 +18,12 @@ interface = gr.Interface(
18
  fn=generate_cloned_voice,
19
  inputs=[
20
  gr.Textbox(label="Enter Translated Text"),
21
- gr.Audio(label="Upload Reference Audio", type="filepath")
 
22
  ],
23
  outputs=gr.Audio(label="Generated Cloned Voice"),
24
  title="Free Voice Cloning API",
25
- description="Upload a sample voice and input text. The system will generate the text in the same voice."
26
  )
27
 
28
  # Launch the Gradio app
 
5
  # Load the voice cloning model
6
  tts = TTS("tts_models/multilingual/multi-dataset/your_tts").to("cpu")
7
 
8
+ def generate_cloned_voice(text, reference_audio, language):
9
  output_path = "output.wav"
10
+
11
+ # Generate cloned speech with language specification
12
+ tts.tts_to_file(text=text, speaker_wav=reference_audio, file_path=output_path, language=language)
13
+
14
  return output_path
15
 
16
  # Create the Gradio interface
 
18
  fn=generate_cloned_voice,
19
  inputs=[
20
  gr.Textbox(label="Enter Translated Text"),
21
+ gr.Audio(label="Upload Reference Audio", type="filepath"),
22
+ gr.Dropdown(["en", "fr", "de", "es", "it"], label="Select Target Language", value="en")
23
  ],
24
  outputs=gr.Audio(label="Generated Cloned Voice"),
25
  title="Free Voice Cloning API",
26
+ description="Upload a sample voice and input text. Select a language, and the system will generate the text in the same voice."
27
  )
28
 
29
  # Launch the Gradio app