Next
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,22 @@
|
|
1 |
import gradio as gr
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
def paths_for_files(path):
|
5 |
return [os.path.abspath(os.path.join(path, f)) for f in os.listdir(path) if os.path.splitext(f)[1].lower() in ('.mp3', '.wav', '.flac', '.ogg')]
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
def change_choices():
|
4 |
+
names = []
|
5 |
+
for name in os.listdir(weight_root):
|
6 |
+
if name.endswith(".pth"):
|
7 |
+
names.append(name)
|
8 |
+
index_paths = []
|
9 |
+
for root, dirs, files in os.walk(index_root, topdown=False):
|
10 |
+
for name in files:
|
11 |
+
if name.endswith(".index") and "trained" not in name:
|
12 |
+
index_paths.append("%s/%s" % (root, name))
|
13 |
+
audios = [os.path.join(audio_root, file) for file in os.listdir(os.path.join(now_dir, "audios"))]
|
14 |
+
|
15 |
+
return {"choices": sorted(names), "__type__": "update"}, {"choices": sorted(index_paths),"__type__": "update"},{
|
16 |
+
"choices": sorted(audios), "__type__": "update"
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
|
21 |
def paths_for_files(path):
|
22 |
return [os.path.abspath(os.path.join(path, f)) for f in os.listdir(path) if os.path.splitext(f)[1].lower() in ('.mp3', '.wav', '.flac', '.ogg')]
|