midhyaraj commited on
Commit
e16556e
·
verified ·
1 Parent(s): dd0af32

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -12
app.py CHANGED
@@ -1,21 +1,24 @@
1
  import os
2
  import subprocess
 
3
 
 
4
  def setup_environment():
5
- # Clone the Tortoise-TTS repository
6
- subprocess.run(["git", "clone", "https://github.com/neonbjb/tortoise-tts.git"], check=True)
 
7
 
8
  # Change directory to the cloned repository
9
  os.chdir("tortoise-tts")
10
 
11
  # Install requirements from requirements.txt
12
- subprocess.run(["pip", "install", "-r", "requirements.txt"], check=True)
13
 
14
  # Install the package using setup.py
15
- subprocess.run(["python", "setup.py", "install"], check=True)
16
 
17
  # Install Gradio
18
- subprocess.run(["pip", "install", "gradio"], check=True)
19
 
20
  def main():
21
  # Call the setup function to ensure everything is installed
@@ -98,10 +101,35 @@ def main():
98
  interface = gr.Interface(
99
  fn=inference,
100
  inputs=[
101
- # Define the inputs you need for your interface here
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  ],
103
  outputs=[
104
- # Define the outputs you need for your interface here
 
 
 
105
  ],
106
  title="RJ VOICE CLONING",
107
  description="<h1 style='text-align: center; color: orange; font-weight: bold;'>RJ VOICE CLONING</h1>",
@@ -117,8 +145,3 @@ if __name__ == "__main__":
117
 
118
  # Run the main function
119
  main()
120
-
121
-
122
-
123
-
124
-
 
1
  import os
2
  import subprocess
3
+ import sys
4
 
5
+ # Function to setup the environment
6
  def setup_environment():
7
+ # Clone the Tortoise-TTS repository if it doesn't exist
8
+ if not os.path.exists("tortoise-tts"):
9
+ subprocess.run(["git", "clone", "https://github.com/neonbjb/tortoise-tts.git"], check=True)
10
 
11
  # Change directory to the cloned repository
12
  os.chdir("tortoise-tts")
13
 
14
  # Install requirements from requirements.txt
15
+ subprocess.run([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"], check=True)
16
 
17
  # Install the package using setup.py
18
+ subprocess.run([sys.executable, "setup.py", "install"], check=True)
19
 
20
  # Install Gradio
21
+ subprocess.run([sys.executable, "-m", "pip", "install", "gradio"], check=True)
22
 
23
  def main():
24
  # Call the setup function to ensure everything is installed
 
101
  interface = gr.Interface(
102
  fn=inference,
103
  inputs=[
104
+ gr.Textbox(lines=4, label="Text:"),
105
+ gr.Radio(["None/Custom", "Happy", "Sad", "Angry", "Disgusted", "Arrogant"],
106
+ value="None/Custom", label="Select emotion:"),
107
+ gr.Textbox(lines=1, label="Enter prompt if [Custom] emotion:"),
108
+ gr.Radio(["ultra_fast", "fast", "standard", "high_quality"],
109
+ value="fast", label="Preset mode:"),
110
+ gr.Dropdown(
111
+ options=os.listdir(os.path.join("tortoise", "voices")) + VOICE_OPTIONS,
112
+ value="angie", # Default voice
113
+ label="Select voice:"
114
+ ),
115
+ gr.Audio(label="Record voice (when selected custom_voice):", type="filepath"),
116
+ gr.Dropdown(
117
+ options=os.listdir(os.path.join("tortoise", "voices")) + VOICE_OPTIONS,
118
+ value="disabled",
119
+ label="(Optional) Select second voice:"
120
+ ),
121
+ gr.Dropdown(
122
+ options=os.listdir(os.path.join("tortoise", "voices")) + VOICE_OPTIONS,
123
+ value="disabled",
124
+ label="(Optional) Select third voice:"
125
+ ),
126
+ gr.Number(value=0, precision=0, label="Seed (for reproducibility):"),
127
  ],
128
  outputs=[
129
+ gr.Audio(label="Sample of selected voice (first):"),
130
+ gr.Audio(label="Output [Candidate 1]:"),
131
+ gr.Audio(label="Output [Candidate 2]:"),
132
+ gr.Audio(label="Output [Candidate 3]:"),
133
  ],
134
  title="RJ VOICE CLONING",
135
  description="<h1 style='text-align: center; color: orange; font-weight: bold;'>RJ VOICE CLONING</h1>",
 
145
 
146
  # Run the main function
147
  main()