Spaces:
Running
Running
admin
commited on
Commit
·
db5e575
1
Parent(s):
6e103ce
fix examples
Browse files
app.py
CHANGED
|
@@ -115,12 +115,11 @@ def infer(wav_path: str, log_name: str, folder_path=TEMP_DIR):
|
|
| 115 |
|
| 116 |
if __name__ == "__main__":
|
| 117 |
warnings.filterwarnings("ignore")
|
| 118 |
-
models = get_modelist()
|
| 119 |
examples = []
|
| 120 |
example_wavs = find_wav_files()
|
| 121 |
-
model_num = len(models)
|
| 122 |
for wav in example_wavs:
|
| 123 |
-
examples.append([wav, models[
|
| 124 |
|
| 125 |
with gr.Blocks() as demo:
|
| 126 |
gr.Interface(
|
|
|
|
| 115 |
|
| 116 |
if __name__ == "__main__":
|
| 117 |
warnings.filterwarnings("ignore")
|
| 118 |
+
models = get_modelist(assign_model="Swin_T_mel")
|
| 119 |
examples = []
|
| 120 |
example_wavs = find_wav_files()
|
|
|
|
| 121 |
for wav in example_wavs:
|
| 122 |
+
examples.append([wav, models[0]])
|
| 123 |
|
| 124 |
with gr.Blocks() as demo:
|
| 125 |
gr.Interface(
|
utils.py
CHANGED
|
@@ -29,7 +29,7 @@ def find_wav_files(folder_path=f"{MODEL_DIR}/examples"):
|
|
| 29 |
return wav_files
|
| 30 |
|
| 31 |
|
| 32 |
-
def get_modelist(model_dir=MODEL_DIR):
|
| 33 |
try:
|
| 34 |
entries = os.listdir(model_dir)
|
| 35 |
except OSError as e:
|
|
@@ -44,7 +44,11 @@ def get_modelist(model_dir=MODEL_DIR):
|
|
| 44 |
continue
|
| 45 |
|
| 46 |
if os.path.isdir(full_path):
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
return output
|
| 50 |
|
|
|
|
| 29 |
return wav_files
|
| 30 |
|
| 31 |
|
| 32 |
+
def get_modelist(model_dir=MODEL_DIR, assign_model=""):
|
| 33 |
try:
|
| 34 |
entries = os.listdir(model_dir)
|
| 35 |
except OSError as e:
|
|
|
|
| 44 |
continue
|
| 45 |
|
| 46 |
if os.path.isdir(full_path):
|
| 47 |
+
model = os.path.basename(full_path)
|
| 48 |
+
if assign_model and assign_model.lower() in model:
|
| 49 |
+
output.insert(0, model)
|
| 50 |
+
else:
|
| 51 |
+
output.append(model)
|
| 52 |
|
| 53 |
return output
|
| 54 |
|