gapi-uz-gapiring-v1

islomov/gapi-uz-gapiring-v1

作者
islomov
任务
语音合成
下载量
0
点赞数
17
趋势分
15
许可证
cc-by-4.0
收录时间
2026/11/25

license: cc-by-4.0 language:

  • uz pipeline_tag: text-to-speech library_name: onnx base_model: kyutai/pocket-tts tags:
  • tts
  • onnx
  • uzbek
  • edge
  • gapiring

Gapiring v1 — Uzbek text-to-speech with roles and manners, Edge and Large

Uzbek text-to-speech in two sizes. Gapiring Edge v1 (110M parameters, 117 MB) runs on an ordinary CPU or entirely in a web browser, with no GPU and no server. Gapiring Large v1 (336M parameters) sounds cleaner and suits a server or a desktop. Both speak in two voices, f1 (female) and m1 (male), take a role and a manner of speech by name, including an emotional mode (angry, upset, worried, tired, ...), and stream audio as it is made. Built on Kyutai's Pocket TTS. Demo Space (Edge in the browser): islomov/gapi-uz-gapiring-v1. Libraries: pip install gapiring, npm install gapiring, Android (Maven), iOS (Swift package: https://github.com/Islomov49/gapiring-ios).

Use it

Python

CPU, no PyTorch. Large (346 MB, the cleaner sound) or Edge (117 MB, about 2.5 times faster); the text normaliser is on, the dictionary of English words is optional.

pip install gapiring
from gapiring import Gapiring

tts = Gapiring("large", precision="int8", dictionary=True)   # or Gapiring("edge")
tts.save("hello.wav", "Assalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman?", voice="f1", role="assistant", manner="warm")

for chunk in tts.stream("Assalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman?", voice="m1", role="operator", manner="calm"):
    play(chunk)                      # float32, 24 kHz mono, as it is made

JavaScript

Browser and Node, WebAssembly. The model is fetched once.

npm install gapiring
import { Gapiring } from "gapiring";

const tts = await Gapiring.load();
for await (const chunk of tts.stream("Assalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman?", { voice: "f1", role: "assistant", manner: "warm" })) {
  play(chunk);                       // Float32Array, 24 kHz mono, as it is made
}

Android

The Edge model is inside the library (about 100 MB): no network, Android 7.0 and later.

// settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        google(); mavenCentral()
        maven("https://huggingface.co/islomov/gapi-uz-gapiring-v1/resolve/main/android/maven")
    }
}
// app/build.gradle.kts
dependencies { implementation("uz.gapi:gapiring:0.1.7") }
import uz.gapi.gapiring.Gapiring

val tts = Gapiring.create(context)   // off the main thread: unpacks the model on the first run
tts.play("Assalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman?", voice = "f1", role = "assistant", manner = "warm")

iOS

The Edge model is inside the Swift package (about 150 MB in an app): no network. iOS 15.1 and later, macOS 14 and later on Apple silicon.

// Xcode: File > Add Package Dependencies... and enter https://github.com/Islomov49/gapiring-ios
// or in Package.swift:
.package(url: "https://github.com/Islomov49/gapiring-ios.git", from: "0.1.7")
import Gapiring

let tts = try Gapiring()             // off the main thread
tts.play("Assalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman?", voice: "f1", role: "assistant", manner: "warm")

From the files of this repository

pip install numpy onnxruntime tokenizers soundfile
python runtime/pocket_onnx.py --bundle large --suffix _int8 --voice f1 --role operator --manner calm \
  --lexicon lexicon/en_uz.tsv --normalize literary \
  --text "Uchrashuv 25-noyabr soat 14:30 da, to'lov Payme orqali, narxi 1 250 000 so'm." --out hello.wav
import sys; sys.path.insert(0, "runtime")
import numpy as np, soundfile as sf
from pocket_onnx import PocketONNX

tts = PocketONNX("large", suffix="_int8", lexicon="lexicon/en_uz.tsv", normalize="literary")   # or PocketONNX("edge", ...)
chunks = tts.speak("Assalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman?", voice="f1", role="assistant", manner="warm")
sf.write("hello.wav", np.concatenate(list(chunks)), 24000)    # chunks arrive as they are made: play them as they come

In the browser, with onnxruntime-web (runtime/web/, the Edge graphs):

import { PocketTTS } from "./pocket_tts.js";
const tts = new PocketTTS();
await tts.load("edge/");            // a folder or a URL that holds the Edge graphs
await tts.say("Assalomu alaykum!", (audio) => play(audio), { voice: "f1", role: "operator", manner: "calm" });

Roles and manners

rolemanner
operatorneutral warm cheerful empathetic calm dictation persuasive brisk
assistantneutral warm cheerful empathetic calm dictation soothing
assistant_formalneutral warm cheerful empathetic calm dictation soothing
emotionalangry upset irritated worried tired sceptical confused hurried joking grateful curious friendly calm elderly

There are two assistants. assistant is a lively helper: it speaks with a person's intonation and now and then hesitates a little, as people do in live speech. assistant_formal is the same helper in an even, measured delivery: choose it for announcements, voice menus, instructions, long texts, and wherever every take should sound the same. emotional is a person on the phone speaking with a feeling: angry, upset (sad), worried, tired, sceptical, and more; it suits call-practice simulators, games and stories. The defaults are role="assistant", manner="neutral". Sounds go inside the text: [laugh], [pause], [breath], [sigh]. The model speaks one sentence or a short paragraph at a time; the Python runtime (speak) and the pip package split a longer text into such pieces themselves, and read the apostrophe variants of o' and g' (ʻ, ʼ, ‘, ’) as the plain one. In the browser and mobile libraries give one sentence or a short paragraph per call.

Text normalisation

normalize="literary" (or --normalize literary) runs the text through the normaliser (runtime/text_front.py, runtime/frontend/, Python standard library only): numbers, dates, times, money, percentages, ranges, units and phone numbers become words; Cyrillic becomes Uzbek Latin; markdown, emoji and quotes are cleaned; known terms are read out; the sound tags stay. normalize="conversational" also turns written forms into the Tashkent spoken ones. Without normalize the text goes to the model as written. In the pip package the normaliser is on by default (literary); normalize=None switches it off. Gapiring() there loads Large int8; Gapiring("edge") the small model.

WrittenSpoken (literary)
Narxi 1 250 000 so'm, QR kodni skaner qiling 😊Narxi bir million ikki yuz ellik ming so'm, kyu-ar kodni skaner qiling.
+998 90 123 45 67 raqamiga qo'ng'iroq qiling.Plyus to'qqiz yuz to'qson sakkiz, to'qson, bir yuz yigirma uch, qirq besh, oltmish yetti raqamiga qo'ng'iroq qiling.
Uchrashuv 25.11.2026 soat 14:30 daUchrashuv yigirma beshinchi noyabr ikki ming yigirma oltinchi yil soat o'n to'rt o'ttizda.
Bugun 50% chegirma, yetkazib berish 3-5 kun, narxi $120Bugun ellik foiz chegirma, yetkazib berish uch-besh kun, narxi bir yuz yigirma dollar.
import sys; sys.path.insert(0, "runtime")
from text_front import prepare
from lexicon import Lexicon
prepare("Narxi 1 250 000 so'm, Payme orqali to'lang", lexicon=Lexicon.load("lexicon/en_uz.tsv"))
# "Narxi bir million ikki yuz ellik ming so'm, Peymi orqali to'lang."

Dictionary: English words and brands the Uzbek way

lexicon/en_uz.tsv holds 564,654 readings: brand and technical terms (CRM -> si-ar-em, Payme -> Peymi, Bitrix24 -> Bitriks yigirma to'rt) and English words read the Uzbek way (deadline -> dedlayn, feedback -> fidbek, box -> boks), with their glued Uzbek suffixes. runtime/lexicon.py applies it: a term is never matched inside a longer word, an acronym in capitals matches only as written (IT is not "it"), and an Uzbek suffix after the term is kept.

import sys; sys.path.insert(0, "runtime")
from lexicon import Lexicon
Lexicon.load("lexicon/en_uz.tsv").apply("To'lovni Paymedan qiling, CRMga o'zi tushadi, deadline ertaga.")
# "To'lovni Peymidan qiling, si-ar-emga o'zi tushadi, dedlayn ertaga."

Loading it takes about 4 s and 400 MB in Python; leave it out on small devices when the text has no English. With normalize it runs first and its readings are kept through the normaliser. The browser runtime loads neither the dictionary nor the normaliser: give it text with numbers as words.

Models and files

EdgeLarge
Folderedge/large/
Transformer layers624
Parameters110M336M
Graphsint8, 117 MBfull precision, 1.3 GB; int8, 346 MB
ForCPU, browser, phoneserver, desktop

Each folder holds the four graphs (text_conditioner, flow_lm_main, flow_lm_flow, mimi_decoder), bundle.json (state manifests and sampling constants), tokenizer.json and voices/ (the two voices, .npy and raw float32 .bin). android/maven/: the Android library (the Edge model inside). The runtime takes the full-precision graphs when a folder has them; PocketONNX("large", suffix="_int8") takes the int8 ones. runtime/pocket_onnx.py, runtime/lexicon.py, runtime/text_front.py and runtime/frontend/: the generation loop, the dictionary and the normaliser with numpy + onnxruntime + tokenizers, no PyTorch. runtime/web/: the same loop for onnxruntime-web, with a tokenizer that matches the Python one id for id. examples/: the clips below.

Synthesis runs on the device and sends nothing anywhere. Recent ONNX Runtime builds report usage to Microsoft by default; the Python runtime and the Android library switch that off (ORT_DISABLE_TELEMETRY=1, set before ONNX Runtime loads; a value you set yourself is left alone). The browser build of ONNX Runtime has no such reporting.

Performance

CPU, onnxruntime 1.23, desktop Intel i5-13600KF, 23 operator and assistant lines (about 3 minutes of speech), one process per setting. Audio is 24 kHz mono, streamed: the first frame is decoded alone for the first audio, then chunks of 240 ms.

ModelThreadsFirst audio, median (max)SpeedPeak memory
Edge, int8131 ms (49)6.9x real time283 MB
Edge, int8221 ms (31)9.7x real time281 MB
Edge, int8427 ms (39)7.3x real time281 MB
Large, int81102 ms (174)2.8x real time744 MB
Large, int8268 ms (116)3.8x real time748 MB
Large, int8467 ms (133)3.8x real time724 MB
Large, full precision2166 ms (275)1.8x real time1.9 GB

Edge in the browser (onnxruntime-web WebAssembly, headless Chrome on the same desktop, the demo Space page): first audio 41-140 ms and 4.2-4.7x real time on three lines, after a one-time 117 MB download. Not measured yet: phones and ARM CPUs.

Quality

Character error rate of an Uzbek speech recogniser on the generated audio (lower is clearer):

LinesEdge, int8Large, full precisionLarge, int8
112 lines across all manners2.85 %2.91 %2.96 %
16 operator and assistant replies of one dialogue4.22 %5.72 %5.68 %

Edge, before int8: 1.41 % on 120 assistant lines and 3.87 % on 131 operator lines. By ear, Large is cleaner on the female voice; the recogniser rates the two alike across manners and Edge a little clearer on the dialogue replies.

Examples

Eight lines a voice agent would say, through the dictionary: a greeting by the lively assistant and the same greeting by the formal one, good news with a laugh, calming a worried customer, an offer, a code read out for dictation, a business update full of English and brand words (Payme, Click, online, CRM, feedback, read the Uzbek way), an apology with a pause; then eight callers in emotional mode: angry, sad, irritated, worried, sceptical, joking with a laugh, grateful, and an elderly caller. Each is the clearest of three takes from each model (examples/edge/, examples/large/, texts in examples/examples.jsonl).

VoiceRoleMannerTextEdgeLarge
f1assistantwarmAssalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman?
f1assistant_formalwarmAssalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman?
m1assistantcheerfulAjoyib yangilik, buyurtmangiz bugun kechgacha yetib boradi [laugh], kuryerimiz allaqachon yo'lga chiqqan!
f1assistantsoothingHech xavotir olmang, kartangizdan yechilgan pul yo'qolmaydi, hoziroq tekshirib muammoni hal qilib beramiz.
m1operatorpersuasiveBugun obunani rasmiylashtirsangiz, birinchi oy uchun to'liq ellik foiz chegirma beriladi, imkoniyatni qo'ldan boy bermang.
f1operatordictationTasdiqlash kodini yozib oling: to'rt, yetti, ikki, to'qqiz, nol, besh. Tayyor bo'lsangiz, davom etamiz.
m1operatorbriskTo'lovni Payme yoki Click orqali online o'tkazsangiz, CRM tizimida ko'rinadi, keyin Telegram guruhda feedback qoldirarsiz.
f1operatorempatheticYetkazib berish kechikkani uchun chin dildan uzr so'rayman [pause], hozir ombor bilan bog'lanib, aniq vaqtini aytaman.
m1emotionalangryNimaga kartamdan pulni ikki marta yechib oldinglar? Yarim soatdan beri telefon qilaman, hech kim ko'tarmaydi-ku!
f1emotionalupsetOyimning tug'ilgan kuniga sovg'a buyurtma qilgandim, [sigh] vaqtida olib kelmadinglar, rosa xafa bo'ldim to'g'risi.
m1emotionalirritatedKuryeringiz ikki soatdan beri yetib kelmayapti, [sigh] issiq ovqatim muzlab qoldi-ku, buyurtmani hoziroq bekor qilinglar!
f1emotionalworriedKartamdan hozirgina uch million so'm o'z-o'zidan yechilib ketdi, [breath] iltimos, uni tezroq bloklab qo'yinglar, juda qo'rqib ketyapman!
f1emotionalscepticalNamuna do'konidagi bu kir yuvish mashinasi rostdan ham sifatlimi, [pause] yoki ikki haftada buzilib qoladigan arzon molmi?
m1emotionaljokingTo'yxonangizga uch yuzta mehmon sig'adi degandingiz, [laugh] bu kichkina zalda qudalar bir-birining tizzasida o'tirib osh yeydimi endi?
f1emotionalgratefulKechasi o'g'limning isitmasi chiqqanda shifokoringiz tez yetib kelib yordam berdi, klinika jamoasiga ming rahmat, baraka topinglar!
m1emotionalelderlyBolam, ko'zim xiraroq ko'radi, [pause] shu elektr hisoblagichning raqamlarini senga sekin o'qib bersam, o'zing to'lovini yozib qo'yasanmi?

Limits and licence

Two voices, three roles and the emotional mode; Uzbek in Latin script (the normaliser converts Cyrillic). Built on Kyutai Pocket TTS (CC-BY-4.0). onnxruntime-web (in the Space) is MIT.

Open source, free for any use, commercial use included. The code is under the MIT licence; the model files, voices and dictionary are under CC BY 4.0 (credit: Gapiring by Gapi, an adaptation of Kyutai Pocket TTS). Full text: LICENSE.

内容来源:Hugging Face 模型卡

在 Hugging Face 查看