vocal_separation/
vocal-separation.rs

1use gradio::{Client, ClientOptions, PredictionInput};
2
3#[tokio::main]
4async fn main() {
5    if std::env::args().len() < 2 {
6        println!("Please provide an audio file path as an argument");
7        std::process::exit(1);
8    }
9    let args: Vec<String> = std::env::args().collect();
10    let file_path = &args[1];
11    println!("File: {}", file_path);
12
13    let client = Client::new("JacobLinCool/vocal-separation", ClientOptions::default())
14        .await
15        .unwrap();
16
17    let output = client
18        .predict(
19            "/separate",
20            vec![
21                PredictionInput::from_file(file_path),
22                PredictionInput::from_value("BS-RoFormer"),
23            ],
24        )
25        .await
26        .unwrap();
27    println!(
28        "Vocals: {}",
29        output[0].clone().as_file().unwrap().url.unwrap()
30    );
31    println!(
32        "Background: {}",
33        output[1].clone().as_file().unwrap().url.unwrap()
34    );
35}