YourMT3 / app.py
shethjenil's picture
Update app.py
5dc34f1 verified
raw
history blame contribute delete
583 Bytes
import yourmt3
import gradio as gr
from huggingface_hub import hf_hub_download
import torch
import os
name = os.getenv("model","YPTF.MoE+Multi (noPS)")
device = "cuda" if torch.cuda.is_available() else "cpu"
model = yourmt3.YMT3(hf_hub_download("shethjenil/Audio2Midi_Models",f"{name}.pt"),name,"32" if device == "cpu" else "16",torch.device(device))
gr.Interface(lambda path,batch_size,progress=gr.Progress():model.predict(path,lambda i,total:progress((i,total)),batch_size),[gr.Audio(type="filepath",label="Audio"),gr.Number(8,label="Batch Size")],gr.File(label="midi")).launch()