### Installing Gradio CLI and Viewing Help Source: https://github.com/jacoblincool/gradio-rs/blob/main/README.md This snippet provides instructions for installing the `gradio-rs` command-line interface using `cargo`, Rust's package manager. It also shows how to access the CLI's help documentation to understand available commands and options. ```sh cargo install gradio gr --help ``` -------------------------------- ### Listing API Specifications for Gradio Space via CLI Source: https://github.com/jacoblincool/gradio-rs/blob/main/README.md This example demonstrates how to use the `gr list` command from the `gradio-rs` CLI to retrieve and display the detailed API specification for a specific Hugging Face Gradio Space, such as `stabilityai/stable-diffusion-3-medium`. It outlines the available parameters, their types, and return values for the `/infer` endpoint. ```sh > gr list stabilityai/stable-diffusion-3-medium API Spec for stabilityai/stable-diffusion-3-medium: /infer Parameters: prompt ( str ) negative_prompt ( str ) seed ( float ) numeric value between 0 and 2147483647 randomize_seed ( bool ) width ( float ) numeric value between 256 and 1344 height ( float ) numeric value between 256 and 1344 guidance_scale ( float ) numeric value between 0.0 and 10.0 num_inference_steps ( float ) numeric value between 1 and 50 Returns: Result ( filepath ) Seed ( float ) numeric value between 0 and 2147483647 ``` -------------------------------- ### Running Stable Diffusion 3 Inference via Gradio CLI Source: https://github.com/jacoblincool/gradio-rs/blob/main/README.md This command-line example illustrates how to perform an image generation inference using the `gr run` command with the `stabilityai/stable-diffusion-3-medium` Gradio Space. It demonstrates passing various parameters like prompt, negative prompt, seed, dimensions, guidance scale, and inference steps, then displays the URL of the generated image and the final seed. ```sh > gr run stabilityai/stable-diffusion-3-medium infer 'Rusty text "AI & CLI" on the snow.' '' 0 true 1024 1024 5 28 Result: https://stabilityai-stable-diffusion-3-medium.hf.space/file=/tmp/gradio/5735ca7775e05f8d56d929d8f57b099a675c0a01/image.webp Seed: 486085626 ``` -------------------------------- ### Separating Vocals and Background Music with Gradio Client in Rust Source: https://github.com/jacoblincool/gradio-rs/blob/main/README.md This Rust example demonstrates how to use the `gradio-rs` client to connect to a Gradio space (specifically, a vocal separation model) and perform a prediction. It shows how to pass a local audio file and a model name as `PredictionInput` and then extract the URLs of the separated vocal and background tracks from the prediction output. The program expects an audio file path as a command-line argument. ```Rust use gradio::{PredictionInput, Client, ClientOptions}; #[tokio::main] async fn main() { if std::env::args().len() < 2 { println!("Please provide an audio file path as an argument"); std::process::exit(1); } let args: Vec = std::env::args().collect(); let file_path = &args[1]; println!("File: {}", file_path); let client = Client::new("JacobLinCool/vocal-separation", ClientOptions::default()) .await .unwrap(); let output = client .predict( "/separate", vec![ PredictionInput::from_file(file_path), PredictionInput::from_value("BS-RoFormer"), ], ) .await .unwrap(); println!( "Vocals: {}", output[0].clone().as_file().unwrap().url.unwrap() ); println!( "Background: {}", output[1].clone().as_file().unwrap().url.unwrap() ); } ``` -------------------------------- ### Transcribing Audio with Whisper Model via Gradio CLI Source: https://github.com/jacoblincool/gradio-rs/blob/main/README.md This snippet showcases how to use the `gr run` command to interact with an audio transcription model (Whisper-large-v3) hosted on a Gradio Space. It demonstrates passing a local audio file path as an argument for the `predict` endpoint and displays the transcribed text output. ```sh gr run hf-audio/whisper-large-v3 predict 'test-audio.wav' 'transcribe' output: " Did you know you can try the coolest model on your command line?" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.