Spaces:
Running
Running
admin commited on
Commit ·
bc1c188
1
Parent(s): 981a678
fix examples
Browse files
app.py
CHANGED
|
@@ -132,12 +132,11 @@ def infer(wav_path: str, log_name: str, folder_path=TEMP_DIR):
|
|
| 132 |
|
| 133 |
if __name__ == "__main__":
|
| 134 |
warnings.filterwarnings("ignore")
|
| 135 |
-
models = get_modelist()
|
| 136 |
examples = []
|
| 137 |
example_wavs = find_wav_files()
|
| 138 |
-
model_num = len(models)
|
| 139 |
for wav in example_wavs:
|
| 140 |
-
examples.append([wav, models[
|
| 141 |
|
| 142 |
with gr.Blocks() as demo:
|
| 143 |
gr.Interface(
|
|
|
|
| 132 |
|
| 133 |
if __name__ == "__main__":
|
| 134 |
warnings.filterwarnings("ignore")
|
| 135 |
+
models = get_modelist(assign_model="GoogleNet_mel")
|
| 136 |
examples = []
|
| 137 |
example_wavs = find_wav_files()
|
|
|
|
| 138 |
for wav in example_wavs:
|
| 139 |
+
examples.append([wav, models[0]])
|
| 140 |
|
| 141 |
with gr.Blocks() as demo:
|
| 142 |
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 |
|