Skip to content

Interactive Application 📤

Gradio is an open-source library for quickly building interactive interfaces for machine learning models, scripts, or tools. It supports web display, link sharing, component dragging, and more, making it ideal for visualization demonstrations or testing.

Use Cases

Scenario 1: I want to record audio and perform vocal separation. What should I do?

1. Define the Application

python
def separate_audio(input):
    # code ...
    return separated_vocals, separated_bg

def init():
    import gradio as gr

    return gr.Interface(
        fn=separate_audio,
        inputs=[
            gr.Audio(type="filepath", label="Input"),
        ],
        outputs=[
            gr.Audio(type="filepath", label="Vocals"),
            gr.Audio(type="filepath", label="Instrumental"),
        ],
        title="CreatorBox Music Source Separation",
    )

if __name__ == "__main__":
    init().launch(server_name="0.0.0.0", server_port=8000)

2. Register the Application

bash
curl -X 'POST' \
```bash
'http://172.18.0.1:8000/app/mounts' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{
    "name": "spleeter",                                   # Name
    "description": "CreatorBox Music Source Separation",  # Description
    "module": "src.support.spleeter_",                    # Path
    "attr": "init",                                       # Method or Variable
    "path": "/spleeter",                                  # Request path
    "status": 1                                           # Status
}'

3. Open the Application