fakeyou-api

Crates.iofakeyou-api
lib.rsfakeyou-api
version0.3.0
sourcesrc
created_at2023-07-08 15:37:18.985424
updated_at2023-07-23 07:22:58.136017
descriptionA very simple Rust library for FakeYou API.
homepagehttps://github.com/alexjercan/fakeyou-api
repository
max_upload_size
id911527
size56,014
Alexandru Jercan (alexjercan)

documentation

README

fakeyou-api

Github Worflow Status Crates.io version docs.rs docs Crates.io downloads Crates.io downloads

A very simple Rust library for FakeYou API.

API

Check the official API reference.

API Support
Text to Speech ✔️
Voices ✔️
Categories ✔️

Usage

Install the library using the Cargo.toml file or run the following command.

cargo add fakeyou-api

Export your API key into the environment variables (if you use the paid version).

export FAKEYOU_API_KEY=...

Then use the crate in your Rust code:

// Import the dependencies
use fakeyou_api::{tts::InferenceBody, util::tts::TtsApiSync, *};

// You can create a default client without any api key.
// You can also load the API key from environment FAKEYOU_API_KEY.
// You can also hadcode through `Auth::new(<your_api_key>)`, but it is not recommended.
let auth = Auth::default();
let fakeyou = FakeYou::new(auth, FAKEYOU_API_URL);

// Create the TTS body
let inference_body =
    InferenceBody::new("TM:ebgxj0j4fvzp", "Hello, World! What should we do today?");

// Call the TTS API
// This uses the util module of this crate and will block the thread until the task is done
let output_result = fakeyou.create_tts_task(&inference_body).unwrap();

// Do what you need with the audio file
std::fs::write("output.wav", output_result.bytes).unwrap();

License

This project is licensed under MIT

Commit count: 0

cargo fmt