-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathparler.rs
35 lines (32 loc) · 922 Bytes
/
parler.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use gradio::{Client, ClientOptions, PredictionInput};
#[tokio::main]
async fn main() {
if std::env::args().len() < 2 {
println!("Please provide the content as an argument");
std::process::exit(1);
}
let args: Vec<String> = std::env::args().collect();
let content = &args[1];
let description = if args.len() > 2 {
&args[2]
} else {
"Talia speaks high quality audio."
};
let client = Client::new("parler-tts/parler-tts-expresso", ClientOptions::default())
.await
.unwrap();
let output = client
.predict(
"/gen_tts",
vec![
PredictionInput::from_value(content),
PredictionInput::from_value(description),
],
)
.await
.unwrap();
println!(
"Generated audio: {}",
output[0].clone().as_file().unwrap().url.unwrap()
);
}