Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ jobs:
bin=$(find build -name zonos2-app -type f | head -1)
out=$("$bin" --help 2>&1 || true)
echo "$out" | grep -q "usage:" || { echo "app smoke failed:"; echo "$out"; exit 1; }
bash tests/app-download-smoke.sh "$bin"
- name: Package
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,14 @@ curl -s http://localhost:1919/tts/generate \
## Desktop App (zonos2-app)

The same server and web UI, packaged as a native window (a [saucer](https://github.com/saucer/saucer)
webview: WebView2 / WKWebView / WebKitGTK). First launch opens a setup page to pick your `.gguf`
files with native file dialogs; the choice is saved (`~/.config/zonos2/app.json`, or the platform
equivalent) and later launches boot straight into the UI. The embedded server binds an ephemeral
`127.0.0.1` port and its whole HTTP API stays reachable while the app runs; closing the window
shuts it down. Release tags ship prebuilt bundles: `zonos2-linux-x64-app.tar.gz`,
webview: WebView2 / WKWebView / WebKitGTK). First launch opens a setup page: pick a model quality
and click **Download & Launch** and it fetches the model files for you (into
`~/.config/zonos2/models`, or the platform equivalent) — same one-click path as the launcher
scripts, no terminal needed. If you already have the `.gguf` files, "I already have the model files"
reveals native file pickers instead. The choice is saved (`~/.config/zonos2/app.json`, or the
platform equivalent) and later launches boot straight into the UI. The embedded server binds an
ephemeral `127.0.0.1` port and its whole HTTP API stays reachable while the app runs; closing the
window shuts it down. Release tags ship prebuilt bundles: `zonos2-linux-x64-app.tar.gz`,
`zonos2-macos-arm64-app.zip` (a `Zonos2.app`), and `zonos2-app.exe` inside the Windows
`zonos2-windows-x64-vulkan.zip`.

Expand Down
138 changes: 112 additions & 26 deletions src/app-pages.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ static const char * ZONOS2_APP_STYLE = R"html(
input[type=text] { flex: 1; background: #0d0f13; color: #e6e8ee; border: 1px solid #2a3040;
border-radius: 7px; padding: 8px 10px; font-size: 13px; min-width: 0; }
input[type=text]:focus { outline: none; border-color: #5b7fd4; }
select { width: 100%; background: #0d0f13; color: #e6e8ee; border: 1px solid #2a3040;
border-radius: 7px; padding: 8px 10px; font-size: 13px; }
select:focus { outline: none; border-color: #5b7fd4; }
a { color: #7fa0ff; text-decoration: none; }
a:hover { text-decoration: underline; }
.bar { height: 8px; background: #0d0f13; border: 1px solid #2a3040; border-radius: 6px;
overflow: hidden; margin: 4px 0 14px; }
.barfill { height: 100%; width: 0; background: #3b5bd6; transition: width .3s ease; }
button { background: #222836; color: #e6e8ee; border: 1px solid #323a4d; border-radius: 7px;
padding: 8px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; }
button:hover { background: #2a3242; }
Expand All @@ -46,49 +54,127 @@ static const char * ZONOS2_APP_STYLE = R"html(

static const char * ZONOS2_APP_SETUP_PAGE = R"html(
<div class="card">
<h1>Zonos2</h1>
<p class="sub">Pick the model files to use. They are saved for the next launch.</p>
<div id="main">
<h1>Zonos2</h1>
<p class="sub">Download the model files to get started, or point to files you already have.</p>

<label>Backbone model (.gguf)</label>
<div class="row"><input type="text" id="model" placeholder="zonos2-q8_0.gguf">
<button onclick="browse('model')">Browse&hellip;</button></div>
<div id="dl-view">
<label>Model quality</label>
<select id="quant">
<option value="q4_k">q4_k &mdash; smallest (4.9 GB)</option>
<option value="q5_k">q5_k (5.8 GB)</option>
<option value="q6_k" selected>q6_k &mdash; recommended (6.8 GB)</option>
<option value="q8_0">q8_0 &mdash; best quality (8.5 GB)</option>
<option value="f16">f16 &mdash; full precision (15.3 GB)</option>
</select>
<div class="check"><input type="checkbox" id="want_spk" checked>
<label for="want_spk" style="margin:0">Include voice cloning (spk-encoder, +20&nbsp;MB)</label></div>
</div>

<label>DAC decoder (.gguf)</label>
<div class="row"><input type="text" id="dac" placeholder="dac.gguf">
<button onclick="browse('dac')">Browse&hellip;</button></div>
<div id="manual-view" style="display:none">
<label>Backbone model (.gguf)</label>
<div class="row"><input type="text" id="model_in" placeholder="zonos2-q6_k.gguf">
<button onclick="browse('model')">Browse&hellip;</button></div>
<label>DAC decoder (.gguf)</label>
<div class="row"><input type="text" id="dac_in" placeholder="dac.gguf">
<button onclick="browse('dac')">Browse&hellip;</button></div>
<label>Speaker encoder (.gguf, optional &mdash; enables voice cloning)</label>
<div class="row"><input type="text" id="spk_in" placeholder="spk-encoder.gguf">
<button onclick="browse('spk')">Browse&hellip;</button></div>
</div>

<label>Speaker encoder (.gguf, optional &mdash; enables voice cloning)</label>
<div class="row"><input type="text" id="spk" placeholder="spk-encoder.gguf">
<button onclick="browse('spk')">Browse&hellip;</button></div>
<div class="check"><input type="checkbox" id="gpu" checked>
<label for="gpu" style="margin:0">Use GPU</label></div>

<div class="check"><input type="checkbox" id="gpu" checked><label for="gpu" style="margin:0">Use GPU</label></div>
<div class="err" id="err"></div>
<button class="primary" id="dlbtn" onclick="download()">Download &amp; Launch</button>
<button class="primary" id="launchbtn" onclick="launchManual()" style="display:none">Save &amp; Launch</button>
<p class="sub" style="margin:14px 0 0"><a href="#" id="toggle" onclick="toggleManual(event)">I already have the model files</a></p>
</div>

<div class="err" id="err"></div>
<button class="primary" id="launch" onclick="launch()">Save &amp; Launch</button>
<div id="progress" style="display:none" class="center">
<div class="spinner"></div>
<h1 id="pgtitle">Downloading&hellip;</h1>
<div class="bar"><div class="barfill" id="barfill"></div></div>
<p class="sub" id="pgtext" style="margin:0">Fetching model files. This can take a while on first launch.</p>
</div>
</div>
<script>
const $ = id => document.getElementById(id);
function fail(msg) { $('err').textContent = msg; $('err').style.display = 'block'; }
function clearErr() { $('err').style.display = 'none'; }
function fmtGB(b) { return (b / 1e9).toFixed(2) + ' GB'; }

let manualOn = false;
function toggleManual(e) {
e.preventDefault(); manualOn = !manualOn; clearErr();
$('dl-view').style.display = manualOn ? 'none' : 'block';
$('manual-view').style.display = manualOn ? 'block' : 'none';
$('dlbtn').style.display = manualOn ? 'none' : 'block';
$('launchbtn').style.display = manualOn ? 'block' : 'none';
$('toggle').textContent = manualOn ? 'Download the models instead' : 'I already have the model files';
}

async function browse(kind) {
try { const p = await saucer.exposed.pick_file(kind); if (p) $(kind).value = p; }
try { const p = await saucer.exposed.pick_file(kind); if (p) $(kind + '_in').value = p; }
catch (e) { fail(String(e)); }
}
async function launch() {
$('err').style.display = 'none';
const model = $('model').value.trim(), dac = $('dac').value.trim(), spk = $('spk').value.trim();

async function doLaunch(model, dac, spk, gpu) {
const err = await saucer.exposed.launch(model, dac, spk, gpu);
if (err) throw new Error(err); // C++ swaps to the splash page on success
}

async function launchManual() {
clearErr();
const model = $('model_in').value.trim(), dac = $('dac_in').value.trim(), spk = $('spk_in').value.trim();
if (!model || !dac) { fail('Backbone model and DAC decoder are required.'); return; }
$('launch').disabled = true;
try {
const err = await saucer.exposed.launch(model, dac, spk, $('gpu').checked);
if (err) { fail(err); $('launch').disabled = false; }
} catch (e) { fail(String(e)); $('launch').disabled = false; }
$('launchbtn').disabled = true;
try { await doLaunch(model, dac, spk, $('gpu').checked); }
catch (e) { fail(String(e.message || e)); $('launchbtn').disabled = false; }
}

async function download() {
clearErr();
const quant = $('quant').value, wantSpk = $('want_spk').checked, gpu = $('gpu').checked;
$('main').style.display = 'none'; $('progress').style.display = 'block';
try { await saucer.exposed.download_models(quant, wantSpk, gpu); }
catch (e) { backToSetup(String(e.message || e)); return; }
poll();
}

function backToSetup(msg) {
$('progress').style.display = 'none'; $('main').style.display = 'block';
if (msg) fail(msg);
}

async function poll() {
let s;
try { s = JSON.parse(await saucer.exposed.download_status()); }
catch (e) { setTimeout(poll, 600); return; }
if (s.file) {
const pct = s.total > 0 ? Math.min(100, 100 * s.done / s.total) : 0;
$('barfill').style.width = pct + '%';
$('pgtitle').textContent = 'Downloading ' + s.file;
$('pgtext').textContent = 'File ' + s.idx + ' of ' + s.count + ' — ' +
fmtGB(s.done) + (s.total > 0 ? ' / ' + fmtGB(s.total) : '');
}
if (s.finished) {
if (!s.ok) { backToSetup(s.error || 'download failed'); return; }
$('pgtitle').textContent = 'Starting…'; $('barfill').style.width = '100%';
try { await doLaunch(s.model, s.dac, s.spk, s.gpu); }
catch (e) { backToSetup(String(e.message || e)); }
return;
}
setTimeout(poll, 600);
}

(async () => {
try {
const cfg = JSON.parse(await saucer.exposed.get_config());
if (cfg.model) $('model').value = cfg.model;
if (cfg.dac) $('dac').value = cfg.dac;
if (cfg.spk) $('spk').value = cfg.spk;
if (cfg.model) $('model_in').value = cfg.model;
if (cfg.dac) $('dac_in').value = cfg.dac;
if (cfg.spk) $('spk_in').value = cfg.spk;
$('gpu').checked = cfg.gpu !== false;
} catch (e) { /* first run: no config yet */ }
})();
Expand Down
Loading
Loading