import torch import os import gradio as gr from audiomaister import VoiceFixer from audiomaister.models.gs_audiomaister import AudioMaister USE_CUDA = torch.cuda.is_available() def load_default_weights(): from huggingface_hub import hf_hub_download from pathlib import Path REPO_ID = "peterwilli/audio-maister" print(f"Loading standard model weight at {REPO_ID}") MODEL_FILE_NAME = "audiomaister_v1.5.ckpt" checkpoint_path = hf_hub_download(repo_id=REPO_ID, filename=MODEL_FILE_NAME) return checkpoint_path def inference(input_file, **kwargs): checkpoint = load_default_weights() state = torch.load(checkpoint, map_location=torch.device('cuda' if USE_CUDA else 'cpu')) main_model = VoiceFixer(state['hparams'], 1, 'vocals') main_model.load_state_dict(state['weights']) inference_model = AudioMaister(main_model) inference_model.restore(input=input_file, output="out.wav", mode=0) if USE_CUDA: main_model.to('cuda') inference_model.to('cuda') return "out.wav" made ="""
Made with ❤ by Raaniel
""" desc = """