textsynth 0.1.0

A (unofficial) wrapper for the TextSynth API, a text synthesization service.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::core::TextSynth;
use crate::engine::Engine;
use crate::prelude::EngineDefinition;
use once_cell::sync::{Lazy, OnceCell};

pub const ENGINE_DEFINITION: EngineDefinition = EngineDefinition::GptJ6B;
static TEXT_SYNTH: OnceCell<TextSynth> = OnceCell::new();
static ENGINE: Lazy<Engine> = Lazy::new(|| get().engine(ENGINE_DEFINITION));

pub fn get() -> &'static TextSynth {
    TEXT_SYNTH.get_or_init(|| TextSynth::new(super::api_key().into()))
}

pub fn engine() -> &'static Engine<'static> {
    &ENGINE
}