Spaces:
Running
on
Zero
Running
on
Zero
Upload 2 files
Browse files- models.json +0 -0
- multi_inference.py +22 -1
models.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
multi_inference.py
CHANGED
|
@@ -13,7 +13,11 @@ SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
| 13 |
sys.path.append(SCRIPT_DIR)
|
| 14 |
os.chdir(SCRIPT_DIR)
|
| 15 |
|
| 16 |
-
from model_list import models_data
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
from utils.preedit_config import conf_editor
|
| 18 |
from utils.download_models import download_model
|
| 19 |
|
|
@@ -27,6 +31,23 @@ class MVSEPLESS:
|
|
| 27 |
self.model_types = MODEL_TYPES
|
| 28 |
self.output_formats = OUTPUT_FORMATS
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
def get_mt(self):
|
| 31 |
return list(models_data.keys())
|
| 32 |
|
|
|
|
| 13 |
sys.path.append(SCRIPT_DIR)
|
| 14 |
os.chdir(SCRIPT_DIR)
|
| 15 |
|
| 16 |
+
# from model_list import models_data
|
| 17 |
+
with open("models.json", "r", encoding="utf-8") as f:
|
| 18 |
+
models_data = json.load(f)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
from utils.preedit_config import conf_editor
|
| 22 |
from utils.download_models import download_model
|
| 23 |
|
|
|
|
| 31 |
self.model_types = MODEL_TYPES
|
| 32 |
self.output_formats = OUTPUT_FORMATS
|
| 33 |
|
| 34 |
+
def add_model(self, mt, mn, cat, full_name, stems, tgt_inst, ckpt, conf):
|
| 35 |
+
if not mt or not mt or not cat or not full_name or not stems or not ckpt or not ckpt:
|
| 36 |
+
return
|
| 37 |
+
|
| 38 |
+
global models_data
|
| 39 |
+
if mt in ["mel_band_roformer", "bs_roformer", "mdx23c", "scnet", "htdemucs", "bandit", "bandit_v2"]:
|
| 40 |
+
models_data[mt][mn] = {
|
| 41 |
+
"category": cat,
|
| 42 |
+
"full_name": full_name,
|
| 43 |
+
"stems": stems,
|
| 44 |
+
"target_instrument": tgt_inst,
|
| 45 |
+
"checkpoint_url": ckpt,
|
| 46 |
+
"config_url": conf
|
| 47 |
+
}
|
| 48 |
+
with open("models.json", "w", encoding="utf-8") as f:
|
| 49 |
+
json.dump(models_data, f, indent=4, ensure_ascii=False)
|
| 50 |
+
|
| 51 |
def get_mt(self):
|
| 52 |
return list(models_data.keys())
|
| 53 |
|