TheMaisk commited on
Commit
41d76e7
1 Parent(s): deeed25

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -12
app.py CHANGED
@@ -1,4 +1,7 @@
1
  import subprocess
 
 
 
2
 
3
  # Run the setup.py install command
4
  try:
@@ -7,10 +10,6 @@ try:
7
  except subprocess.CalledProcessError as e:
8
  print(f"Installation failed with error: {e}")
9
 
10
- import gradio as gr
11
- import torch
12
- from TTS.api import TTS
13
-
14
  # Get device
15
  device = "cuda" if torch.cuda.is_available() else "cpu"
16
 
@@ -23,12 +22,16 @@ def voice_clone(text: str, speaker_wav: str, language: str):
23
  tts.tts_to_file(text=text, speaker_wav=speaker_wav, language=language, file_path="output.wav")
24
  return "output.wav"
25
 
26
- iface = gr.Interface(fn=voice_clone,
27
- inputs=[gr.Textbox(lines=2, placeholder="Enter the text...", label="Text"),
28
- gr.Audio(type="filepath", label="Upload audio file"),
29
- gr.Radio(['ru', 'en', 'zh-cn', 'ja', 'de', 'fr', 'it', 'pt', 'pl', 'tr', 'ko', 'nl', 'cs', 'ar', 'es', 'hu'], label="language"),
30
- ],
31
- outputs=gr.Audio(type="filepath", label="Generated audio file"),
32
- title="Voice Cloning")
 
 
 
 
33
 
34
- iface.launch()
 
1
  import subprocess
2
+ import gradio as gr
3
+ import torch
4
+ from TTS.api import TTS
5
 
6
  # Run the setup.py install command
7
  try:
 
10
  except subprocess.CalledProcessError as e:
11
  print(f"Installation failed with error: {e}")
12
 
 
 
 
 
13
  # Get device
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
15
 
 
22
  tts.tts_to_file(text=text, speaker_wav=speaker_wav, language=language, file_path="output.wav")
23
  return "output.wav"
24
 
25
+ iface = gr.Interface(
26
+ fn=voice_clone,
27
+ inputs=[
28
+ gr.Textbox(lines=2, placeholder="Enter the text...", label="Text"),
29
+ gr.Audio(type="filepath", label="Upload audio file"),
30
+ gr.Radio(['ru', 'en', 'zh-cn', 'ja', 'de', 'fr', 'it', 'pt', 'pl', 'tr', 'ko', 'nl', 'cs', 'ar', 'es', 'hu'], label="language"),
31
+ ],
32
+ outputs=gr.Audio(type="filepath", label="Generated audio file"),
33
+ title="Voice Cloning",
34
+ theme="syddharth/gray-minimal" # Add the theme here
35
+ )
36
 
37
+ iface.launch()