Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -95,7 +95,13 @@ def download_from_url(url, model):
|
|
95 |
except:
|
96 |
return "There's been an error.", {"choices":show_available("assets/weights"),"__type__":"update"}
|
97 |
|
98 |
-
def show_available(filepath):
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
return os.listdir(filepath)
|
100 |
|
101 |
def upload_file(file):
|
@@ -130,7 +136,7 @@ with gr.Blocks() as app:
|
|
130 |
with gr.Column():
|
131 |
with gr.Tabs():
|
132 |
with gr.TabItem("1.Choose a voice model:"):
|
133 |
-
model_picker = gr.Dropdown(label="",choices=show_available('assets/weights'),value='',interactive=True)
|
134 |
with gr.TabItem("(Or download a model here)"):
|
135 |
with gr.Row():
|
136 |
url = gr.Textbox(label="Paste the URL here:",value="",placeholder="(i.e. https://huggingface.co/repo/model/resolve/main/model.zip)")
|
|
|
95 |
except:
|
96 |
return "There's been an error.", {"choices":show_available("assets/weights"),"__type__":"update"}
|
97 |
|
98 |
+
def show_available(filepath,format=None):
|
99 |
+
if format:
|
100 |
+
files = []
|
101 |
+
for file in os.listdir(filepath):
|
102 |
+
if file in os.listdir(filepath).endswith(format):
|
103 |
+
files.append(file)
|
104 |
+
return files
|
105 |
return os.listdir(filepath)
|
106 |
|
107 |
def upload_file(file):
|
|
|
136 |
with gr.Column():
|
137 |
with gr.Tabs():
|
138 |
with gr.TabItem("1.Choose a voice model:"):
|
139 |
+
model_picker = gr.Dropdown(label="",choices=show_available('assets/weights','.pth'),value='',interactive=True)
|
140 |
with gr.TabItem("(Or download a model here)"):
|
141 |
with gr.Row():
|
142 |
url = gr.Textbox(label="Paste the URL here:",value="",placeholder="(i.e. https://huggingface.co/repo/model/resolve/main/model.zip)")
|