import gradio as gr
from rvc_infer import download_online_model

def download_model(url, dir_name):
    output_models = download_online_model(url, dir_name)
    return output_models



with gr.Blocks() as demo:
    with gr.Tab("inferenece"):
        gr.Markdown("in progress")
    with gr.Tab("Download model"):
        gr.Markdown("## Download Model for infernece")
        url_input = gr.Textbox(label="Model URL", placeholder="Enter the URL of the model")
        dir_name_input = gr.Textbox(label="Directory Name", placeholder="Enter the directory name")
    
    output = gr.Textbox(label="Output Models")
    
    download_button = gr.Button("Download Model")
    
    download_button.click(download_model, inputs=[url_input, dir_name_input], outputs=output)
    
demo.launch()