Spaces:
Running
Running
add config
Browse files
app.py
CHANGED
|
@@ -2,22 +2,20 @@ import gradio as gr
|
|
| 2 |
import torch
|
| 3 |
import soundfile as sf
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
|
| 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
|
|
|
|
| 2 |
import torch
|
| 3 |
import soundfile as sf
|
| 4 |
import numpy as np
|
| 5 |
+
import yaml
|
| 6 |
from inference import MasteringStyleTransfer
|
| 7 |
from utils import download_youtube_audio
|
| 8 |
from config import config
|
| 9 |
|
| 10 |
# Initialize MasteringStyleTransfer
|
| 11 |
args = type('Args', (), vars(config))()
|
| 12 |
+
# load network configurations
|
| 13 |
+
with open(args.path_to_config, 'r') as f:
|
| 14 |
+
configs = yaml.full_load(f)
|
| 15 |
+
args.cfg_converter = configs['TCN']['param_mapping']
|
| 16 |
+
args.cfg_enc = configs['Effects_Encoder']['default']
|
| 17 |
|
| 18 |
+
mastering_transfer = MasteringStyleTransfer(args)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
def process_audio(input_audio, reference_audio, perform_ito):
|
| 21 |
# Process the audio files
|
config.py
CHANGED
|
@@ -24,7 +24,5 @@ class Config:
|
|
| 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()
|
|
|
|
| 24 |
train_ito = True
|
| 25 |
max_iter_ito = 101
|
| 26 |
ito_type = "blackbox"
|
|
|
|
|
|
|
| 27 |
|
| 28 |
+
config = Config()
|