Spaces:
Running
Running
add config
Browse files
app.py
CHANGED
@@ -4,16 +4,21 @@ import soundfile as sf
|
|
4 |
import numpy as np
|
5 |
from inference import MasteringStyleTransfer
|
6 |
from utils import download_youtube_audio
|
|
|
7 |
|
8 |
# Initialize MasteringStyleTransfer
|
9 |
-
args = type('Args', (),
|
10 |
-
"model_path": "models/mastering_converter.pt",
|
11 |
-
"encoder_path": "models/effects_encoder.pt",
|
12 |
-
"sample_rate": 44100,
|
13 |
-
"path_to_config": "networks/configs.yaml"
|
14 |
-
})()
|
15 |
mastering_transfer = MasteringStyleTransfer(args)
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
def process_audio(input_audio, reference_audio, perform_ito):
|
18 |
# Process the audio files
|
19 |
output_audio, predicted_params, ito_output_audio, ito_predicted_params, _, sr, _ = mastering_transfer.process_audio(
|
|
|
4 |
import numpy as np
|
5 |
from inference import MasteringStyleTransfer
|
6 |
from utils import download_youtube_audio
|
7 |
+
from config import config
|
8 |
|
9 |
# Initialize MasteringStyleTransfer
|
10 |
+
args = type('Args', (), vars(config))()
|
|
|
|
|
|
|
|
|
|
|
11 |
mastering_transfer = MasteringStyleTransfer(args)
|
12 |
|
13 |
+
# # Initialize MasteringStyleTransfer
|
14 |
+
# args = type('Args', (), {
|
15 |
+
# "model_path": "models/mastering_converter.pt",
|
16 |
+
# "encoder_path": "models/effects_encoder.pt",
|
17 |
+
# "sample_rate": 44100,
|
18 |
+
# "path_to_config": "networks/configs.yaml"
|
19 |
+
# })()
|
20 |
+
# mastering_transfer = MasteringStyleTransfer(args)
|
21 |
+
|
22 |
def process_audio(input_audio, reference_audio, perform_ito):
|
23 |
# Process the audio files
|
24 |
output_audio, predicted_params, ito_output_audio, ito_predicted_params, _, sr, _ = mastering_transfer.process_audio(
|
config.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
class Config:
|
4 |
+
model_path = "models/mastering_converter.pt"
|
5 |
+
encoder_path = "models/effects_encoder.pt"
|
6 |
+
sample_rate = 44100
|
7 |
+
path_to_config = "networks/configs.yaml"
|
8 |
+
|
9 |
+
# Add more configurations as needed
|
10 |
+
inference_only = True
|
11 |
+
evaluate_only = False
|
12 |
+
reload_enc = True
|
13 |
+
reload_converter = True
|
14 |
+
manual_reload_enc = False
|
15 |
+
manual_reload_converter = False
|
16 |
+
manual_reload_name_converter = "dasp_tcn_tuneenc_daspman_loudnessnorm"
|
17 |
+
manual_reload_name_encoder = "dasp_tcn_tuneenc_daspman_loudnessnorm"
|
18 |
+
manual_reload_enc_path = "models/effects_encoder.pt"
|
19 |
+
reload_epoch_converter = 1000
|
20 |
+
reload_epoch_enc = 1000
|
21 |
+
|
22 |
+
# Add other configurations from the main.py file
|
23 |
+
random_seed = 111
|
24 |
+
train_ito = True
|
25 |
+
max_iter_ito = 101
|
26 |
+
ito_type = "blackbox"
|
27 |
+
|
28 |
+
# You can add more configurations as needed
|
29 |
+
|
30 |
+
config = Config()
|