fffiloni commited on
Commit
0bd14d2
1 Parent(s): 0435c60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -17
app.py CHANGED
@@ -40,7 +40,6 @@ def infer(prompt, input_wav_file):
40
  # Move the WAV file to the new directory
41
  shutil.move(source_path, os.path.join(destination_path, f"{file_name}.wav"))
42
 
43
-
44
  text = prompt
45
 
46
  # with random speaker
@@ -72,27 +71,49 @@ def infer(prompt, input_wav_file):
72
  for item in contents:
73
  print(item)
74
 
75
- return "output.wav", f"bark_voices/{file_name}/{content[1]}"
76
-
77
- gr.Interface(
78
- fn=infer,
79
- inputs=[
80
- gr.Textbox(
 
 
 
 
 
 
 
 
81
  label="Text to speech prompt"
82
- ),
83
- gr.Audio(
 
84
  label="WAV voice to clone",
85
  type="filepath",
86
  source="upload"
87
  )
88
- ],
89
- outputs=[
90
- gr.Audio(
 
91
  label="Text to speech output"
92
- ),
93
- gr.File(
 
94
  label=".npz file"
95
  )
96
- ],
97
- title="Instant Voice Cloning"
98
- ).launch()
 
 
 
 
 
 
 
 
 
 
 
 
40
  # Move the WAV file to the new directory
41
  shutil.move(source_path, os.path.join(destination_path, f"{file_name}.wav"))
42
 
 
43
  text = prompt
44
 
45
  # with random speaker
 
71
  for item in contents:
72
  print(item)
73
 
74
+ return "output.wav", f"bark_voices/{file_name}/{contents[1]}"
75
+
76
+ css = """
77
+ #col-container {max-width: 780px; margin-left: auto; margin-right: auto;}
78
+ """
79
+
80
+ with gr.Blocks(css=css) as demo:
81
+ with gr.Column(elem_id="col-container"):
82
+
83
+ gr.HTML("""
84
+ <h1>Instant Voice Cloning</h1>
85
+ """)
86
+
87
+ prompt = gr.Textbox(
88
  label="Text to speech prompt"
89
+ )
90
+
91
+ audio_in = gr.Audio(
92
  label="WAV voice to clone",
93
  type="filepath",
94
  source="upload"
95
  )
96
+
97
+ submit_btn = gr.Button("Submit")
98
+
99
+ cloned_out = gr.Audio(
100
  label="Text to speech output"
101
+ )
102
+
103
+ npz_file = gr.File(
104
  label=".npz file"
105
  )
106
+
107
+ submit_btn.click(
108
+ fn = infer,
109
+ inputs = [
110
+ prompt,
111
+ audio_in
112
+ ],
113
+ outputs = [
114
+ cloned_out,
115
+ npz_file
116
+ ]
117
+ )
118
+
119
+ demo.queue().launch()