yoyolicoris commited on
Commit
6e3fef9
·
1 Parent(s): be592cf

refactor app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -19
app.py CHANGED
@@ -9,34 +9,20 @@ from random import normalvariate
9
  from soxr import resample
10
  from functools import partial
11
 
12
- from src.modules.utils import chain_functions, vec2statedict, get_chunks
13
- from src.modules.fx import clip_delay_eq_Q
14
 
15
  SLIDER_MAX = 3
16
  SLIDER_MIN = -3
17
  NUMBER_OF_PCS = 10
18
  TEMPERATURE = 0.7
19
- CONFIG_PATH = "src/presets/rt_config.yaml"
20
- PCA_PARAM_FILE = "src/presets/internal/gaussian.npz"
21
- INFO_PATH = "src/presets/internal/info.json"
22
 
23
 
24
  with open(CONFIG_PATH) as fp:
25
  fx_config = yaml.safe_load(fp)["model"]
26
- # append "src." to the module name
27
- appendsrc = lambda d: (
28
- {
29
- k: (
30
- f"src.{v}"
31
- if (k == "_target_" and v.startswith("modules."))
32
- else appendsrc(v)
33
- )
34
- for k, v in d.items()
35
- }
36
- if isinstance(d, dict)
37
- else (list(map(appendsrc, d)) if isinstance(d, list) else d)
38
- )
39
- fx_config = appendsrc(fx_config) # type: ignore
40
 
41
  fx = instantiate(fx_config)
42
  fx.eval()
 
9
  from soxr import resample
10
  from functools import partial
11
 
12
+ from modules.utils import chain_functions, vec2statedict, get_chunks
13
+ from modules.fx import clip_delay_eq_Q
14
 
15
  SLIDER_MAX = 3
16
  SLIDER_MIN = -3
17
  NUMBER_OF_PCS = 10
18
  TEMPERATURE = 0.7
19
+ CONFIG_PATH = "presets/rt_config.yaml"
20
+ PCA_PARAM_FILE = "presets/internal/gaussian.npz"
21
+ INFO_PATH = "presets/internal/info.json"
22
 
23
 
24
  with open(CONFIG_PATH) as fp:
25
  fx_config = yaml.safe_load(fp)["model"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  fx = instantiate(fx_config)
28
  fx.eval()