Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,12 @@
|
|
1 |
import os
|
2 |
|
3 |
def list_files_tree(directory, indent=""):
|
4 |
-
# 获取当前目录下的所有文件和文件夹
|
5 |
items = os.listdir(directory)
|
6 |
for i, item in enumerate(items):
|
7 |
-
# 定义前缀,最后一个文件或文件夹使用不同的前缀
|
8 |
prefix = "└── " if i == len(items) - 1 else "├── "
|
9 |
-
# 打印文件或文件夹
|
10 |
print(indent + prefix + item)
|
11 |
-
# 如果是文件夹,则递归调用
|
12 |
item_path = os.path.join(directory, item)
|
13 |
if os.path.isdir(item_path):
|
14 |
-
# 如果是最后一个子文件夹,使用缩进
|
15 |
next_indent = indent + (" " if i == len(items) - 1 else "│ ")
|
16 |
list_files_tree(item_path, next_indent)
|
17 |
|
@@ -19,7 +14,8 @@ from huggingface_hub import snapshot_download
|
|
19 |
print("Models...")
|
20 |
models_id = """None1145/GPT-SoVITS-Lappland-the-Decadenza
|
21 |
None1145/GPT-SoVITS-Theresa
|
22 |
-
None1145/GPT-SoVITS-Vulpisfoglia
|
|
|
23 |
for model_id in models_id.split("\n"):
|
24 |
if model_id in ["", " "]:
|
25 |
break
|
@@ -93,7 +89,6 @@ def load_model(sovits_path, gpt_path):
|
|
93 |
def __init__(self, input_dict):
|
94 |
for key, value in input_dict.items():
|
95 |
if isinstance(value, dict):
|
96 |
-
# 如果值是字典,递归调用构造函数
|
97 |
setattr(self, key, DictToAttrRecursive(value))
|
98 |
else:
|
99 |
setattr(self, key, value)
|
@@ -312,11 +307,17 @@ with gr.Blocks() as app:
|
|
312 |
'</div>')
|
313 |
with gr.Row():
|
314 |
with gr.Column():
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
inp_ref_audio = gr.Audio(
|
321 |
label="Reference Audio",
|
322 |
type="filepath",
|
@@ -329,9 +330,17 @@ with gr.Blocks() as app:
|
|
329 |
inputs=[prompt_text, transcripts_state],
|
330 |
outputs=[inp_ref_audio]
|
331 |
)
|
332 |
-
prompt_language = gr.State(value="zh")
|
333 |
with gr.Column():
|
334 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
text_language = gr.Dropdown(
|
336 |
label="Language",
|
337 |
choices=["zh", "en", "ja"],
|
|
|
1 |
import os
|
2 |
|
3 |
def list_files_tree(directory, indent=""):
|
|
|
4 |
items = os.listdir(directory)
|
5 |
for i, item in enumerate(items):
|
|
|
6 |
prefix = "└── " if i == len(items) - 1 else "├── "
|
|
|
7 |
print(indent + prefix + item)
|
|
|
8 |
item_path = os.path.join(directory, item)
|
9 |
if os.path.isdir(item_path):
|
|
|
10 |
next_indent = indent + (" " if i == len(items) - 1 else "│ ")
|
11 |
list_files_tree(item_path, next_indent)
|
12 |
|
|
|
14 |
print("Models...")
|
15 |
models_id = """None1145/GPT-SoVITS-Lappland-the-Decadenza
|
16 |
None1145/GPT-SoVITS-Theresa
|
17 |
+
None1145/GPT-SoVITS-Vulpisfoglia
|
18 |
+
None1145/GPT-SoVITS-Theresa-Recording"""
|
19 |
for model_id in models_id.split("\n"):
|
20 |
if model_id in ["", " "]:
|
21 |
break
|
|
|
89 |
def __init__(self, input_dict):
|
90 |
for key, value in input_dict.items():
|
91 |
if isinstance(value, dict):
|
|
|
92 |
setattr(self, key, DictToAttrRecursive(value))
|
93 |
else:
|
94 |
setattr(self, key, value)
|
|
|
307 |
'</div>')
|
308 |
with gr.Row():
|
309 |
with gr.Column():
|
310 |
+
with gr.Column():
|
311 |
+
prompt_text = gr.Dropdown(
|
312 |
+
label="Transcript of the Reference Audio",
|
313 |
+
value=example_reference,
|
314 |
+
choices=list(transcript.keys())
|
315 |
+
)
|
316 |
+
prompt_language = gr.Dropdown(
|
317 |
+
label="Language of the Reference Audio",
|
318 |
+
value="zh",
|
319 |
+
choices=["zh", "ja", "en"]
|
320 |
+
)
|
321 |
inp_ref_audio = gr.Audio(
|
322 |
label="Reference Audio",
|
323 |
type="filepath",
|
|
|
330 |
inputs=[prompt_text, transcripts_state],
|
331 |
outputs=[inp_ref_audio]
|
332 |
)
|
333 |
+
# prompt_language = gr.State(value="zh")
|
334 |
with gr.Column():
|
335 |
+
if prompt_language.value == "zh":
|
336 |
+
initial_text = "你好"
|
337 |
+
elif prompt_language.value == "ja":
|
338 |
+
initial_text = "こんにちは"
|
339 |
+
elif prompt_language.value == "en":
|
340 |
+
initial_text = "Hello"
|
341 |
+
else:
|
342 |
+
initial_text = "你好"
|
343 |
+
text = gr.Textbox(label="Input Text", value=initial_text)
|
344 |
text_language = gr.Dropdown(
|
345 |
label="Language",
|
346 |
choices=["zh", "en", "ja"],
|