Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
120 words
Browse files
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: πποΈ
|
|
| 4 |
colorFrom: red
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 3.
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
|
|
|
| 4 |
colorFrom: red
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 3.6
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
app.py
CHANGED
|
@@ -28,7 +28,7 @@ def create_tts_fn(model, hps, speaker_ids):
|
|
| 28 |
def tts_fn(text, speaker, speed, is_phoneme):
|
| 29 |
if limitation:
|
| 30 |
text_len = len(text)
|
| 31 |
-
max_len =
|
| 32 |
if is_phoneme:
|
| 33 |
max_len *= 3
|
| 34 |
else:
|
|
@@ -57,7 +57,7 @@ def create_vc_fn(model, hps, speaker_ids):
|
|
| 57 |
return "You need to upload an audio", None
|
| 58 |
sampling_rate, audio = input_audio
|
| 59 |
duration = audio.shape[0] / sampling_rate
|
| 60 |
-
if limitation and duration >
|
| 61 |
return "Error: Audio is too long", None
|
| 62 |
original_speaker_id = speaker_ids[original_speaker]
|
| 63 |
target_speaker_id = speaker_ids[target_speaker]
|
|
@@ -93,7 +93,7 @@ def create_soft_vc_fn(model, hps, speaker_ids):
|
|
| 93 |
return "You need to upload an audio", None
|
| 94 |
sampling_rate, audio = input_audio
|
| 95 |
duration = audio.shape[0] / sampling_rate
|
| 96 |
-
if limitation and duration >
|
| 97 |
return "Error: Audio is too long", None
|
| 98 |
target_speaker_id = speaker_ids[target_speaker]
|
| 99 |
|
|
@@ -191,7 +191,7 @@ if __name__ == '__main__':
|
|
| 191 |
gr.Markdown(f"## {name}\n\n"
|
| 192 |
f"\n\n"
|
| 193 |
f"lang: {lang}")
|
| 194 |
-
tts_input1 = gr.TextArea(label="Text (
|
| 195 |
elem_id=f"tts-input{i}")
|
| 196 |
tts_input2 = gr.Dropdown(label="Speaker", choices=speakers,
|
| 197 |
type="index", value=speakers[0])
|
|
@@ -240,7 +240,7 @@ if __name__ == '__main__':
|
|
| 240 |
value=speakers[0])
|
| 241 |
vc_input2 = gr.Dropdown(label="Target Speaker", choices=speakers, type="index",
|
| 242 |
value=speakers[1])
|
| 243 |
-
vc_input3 = gr.Audio(label="Input Audio (
|
| 244 |
vc_submit = gr.Button("Convert", variant="primary")
|
| 245 |
vc_output1 = gr.Textbox(label="Output Message")
|
| 246 |
vc_output2 = gr.Audio(label="Output Audio")
|
|
@@ -256,9 +256,9 @@ if __name__ == '__main__':
|
|
| 256 |
source_tabs = gr.Tabs()
|
| 257 |
with source_tabs:
|
| 258 |
with gr.TabItem("microphone"):
|
| 259 |
-
vc_input2 = gr.Audio(label="Input Audio (
|
| 260 |
with gr.TabItem("upload"):
|
| 261 |
-
vc_input3 = gr.Audio(label="Input Audio (
|
| 262 |
vc_submit = gr.Button("Convert", variant="primary")
|
| 263 |
vc_output1 = gr.Textbox(label="Output Message")
|
| 264 |
vc_output2 = gr.Audio(label="Output Audio")
|
|
|
|
| 28 |
def tts_fn(text, speaker, speed, is_phoneme):
|
| 29 |
if limitation:
|
| 30 |
text_len = len(text)
|
| 31 |
+
max_len = 120
|
| 32 |
if is_phoneme:
|
| 33 |
max_len *= 3
|
| 34 |
else:
|
|
|
|
| 57 |
return "You need to upload an audio", None
|
| 58 |
sampling_rate, audio = input_audio
|
| 59 |
duration = audio.shape[0] / sampling_rate
|
| 60 |
+
if limitation and duration > 30:
|
| 61 |
return "Error: Audio is too long", None
|
| 62 |
original_speaker_id = speaker_ids[original_speaker]
|
| 63 |
target_speaker_id = speaker_ids[target_speaker]
|
|
|
|
| 93 |
return "You need to upload an audio", None
|
| 94 |
sampling_rate, audio = input_audio
|
| 95 |
duration = audio.shape[0] / sampling_rate
|
| 96 |
+
if limitation and duration > 30:
|
| 97 |
return "Error: Audio is too long", None
|
| 98 |
target_speaker_id = speaker_ids[target_speaker]
|
| 99 |
|
|
|
|
| 191 |
gr.Markdown(f"## {name}\n\n"
|
| 192 |
f"\n\n"
|
| 193 |
f"lang: {lang}")
|
| 194 |
+
tts_input1 = gr.TextArea(label="Text (120 words limitation)", value=example,
|
| 195 |
elem_id=f"tts-input{i}")
|
| 196 |
tts_input2 = gr.Dropdown(label="Speaker", choices=speakers,
|
| 197 |
type="index", value=speakers[0])
|
|
|
|
| 240 |
value=speakers[0])
|
| 241 |
vc_input2 = gr.Dropdown(label="Target Speaker", choices=speakers, type="index",
|
| 242 |
value=speakers[1])
|
| 243 |
+
vc_input3 = gr.Audio(label="Input Audio (30s limitation)")
|
| 244 |
vc_submit = gr.Button("Convert", variant="primary")
|
| 245 |
vc_output1 = gr.Textbox(label="Output Message")
|
| 246 |
vc_output2 = gr.Audio(label="Output Audio")
|
|
|
|
| 256 |
source_tabs = gr.Tabs()
|
| 257 |
with source_tabs:
|
| 258 |
with gr.TabItem("microphone"):
|
| 259 |
+
vc_input2 = gr.Audio(label="Input Audio (30s limitation)", source="microphone")
|
| 260 |
with gr.TabItem("upload"):
|
| 261 |
+
vc_input3 = gr.Audio(label="Input Audio (30s limitation)", source="upload")
|
| 262 |
vc_submit = gr.Button("Convert", variant="primary")
|
| 263 |
vc_output1 = gr.Textbox(label="Output Message")
|
| 264 |
vc_output2 = gr.Audio(label="Output Audio")
|