Deploy Kith — relationship memory on small open models (ZeroGPU)
Browse files- .gitattributes +6 -0
- README.md +2 -2
- app.py +16 -0
- data/demo-clips/aunt-rose-call.mp3 +3 -0
- data/demo-clips/call-with-mom.mp3 +3 -0
- data/demo-clips/coffee-catchup.mp3 +3 -0
- data/demo-clips/daniel-career.mp3 +3 -0
- data/demo-clips/planning-with-partner.mp3 +3 -0
- data/demo-clips/sara-wedding.mp3 +3 -0
- frontend.py +29 -9
.gitattributes
CHANGED
|
@@ -34,3 +34,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
data/sample-conversation.mp3 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
data/sample-conversation.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
data/demo-clips/aunt-rose-call.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
data/demo-clips/call-with-mom.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
data/demo-clips/coffee-catchup.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
data/demo-clips/daniel-career.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
data/demo-clips/planning-with-partner.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
data/demo-clips/sara-wedding.mp3 filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -88,8 +88,8 @@ weights during UI work.
|
|
| 88 |
|
| 89 |
## Demo video
|
| 90 |
|
| 91 |
-
*(link
|
| 92 |
|
| 93 |
## Social post
|
| 94 |
|
| 95 |
-
*(link
|
|
|
|
| 88 |
|
| 89 |
## Demo video
|
| 90 |
|
| 91 |
+
*(YouTube link to be added)*
|
| 92 |
|
| 93 |
## Social post
|
| 94 |
|
| 95 |
+
*(link to be added)*
|
app.py
CHANGED
|
@@ -132,6 +132,22 @@ async def sample_audio() -> FileResponse:
|
|
| 132 |
)
|
| 133 |
|
| 134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
@server.api(name="transcribe")
|
| 136 |
def transcribe_api(audio_b64: str) -> str:
|
| 137 |
"""16kHz mono WAV, base64-encoded by the browser -> transcript text."""
|
|
|
|
| 132 |
)
|
| 133 |
|
| 134 |
|
| 135 |
+
# Curated demo scenarios the UI can one-click test. Whitelisted (no path traversal).
|
| 136 |
+
DEMO_CLIPS = {"sara-wedding", "daniel-career", "aunt-rose-call"}
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
@server.get("/clip/{name}")
|
| 140 |
+
async def demo_clip(name: str) -> FileResponse:
|
| 141 |
+
from fastapi import HTTPException
|
| 142 |
+
|
| 143 |
+
if name not in DEMO_CLIPS:
|
| 144 |
+
raise HTTPException(status_code=404, detail="unknown clip")
|
| 145 |
+
return FileResponse(
|
| 146 |
+
os.path.join(os.path.dirname(__file__), "data", "demo-clips", f"{name}.mp3"),
|
| 147 |
+
media_type="audio/mpeg",
|
| 148 |
+
)
|
| 149 |
+
|
| 150 |
+
|
| 151 |
@server.api(name="transcribe")
|
| 152 |
def transcribe_api(audio_b64: str) -> str:
|
| 153 |
"""16kHz mono WAV, base64-encoded by the browser -> transcript text."""
|
data/demo-clips/aunt-rose-call.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6805809b3d55723f52c0a0d56888b8d6c8b13a9595a02605113f0e28f22b3baa
|
| 3 |
+
size 574464
|
data/demo-clips/call-with-mom.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3795a02d56dcb322f6fa367faad9b816e95d3769faaf23c0412363dc545393d7
|
| 3 |
+
size 559680
|
data/demo-clips/coffee-catchup.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2bca59dbbce1895e3cc72f4de653beee862977e9c3e47c63db5fc4f35c7fbae1
|
| 3 |
+
size 610944
|
data/demo-clips/daniel-career.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:108b86980f14f4965fd5ad658eba56b5c971cb4a73d1b5e120dcd4cb26528e20
|
| 3 |
+
size 642048
|
data/demo-clips/planning-with-partner.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:17fe1c46bde3a9b6ad4d4c7cc441df8a0093f2132b4ec867d4b785e266bd43e9
|
| 3 |
+
size 564096
|
data/demo-clips/sara-wedding.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b508913ebf18be8750e4e0cd545fd7e384828dd7a51c81240db90b2d4a7f84c2
|
| 3 |
+
size 587136
|
frontend.py
CHANGED
|
@@ -112,6 +112,17 @@ FRONTEND_HTML = r"""<!doctype html>
|
|
| 112 |
.alt-sources a { color:var(--terracotta-deep); font-size:13px; font-weight:520; text-decoration:none; cursor:pointer; }
|
| 113 |
.alt-sources a:hover { text-decoration:underline; }
|
| 114 |
#fileInput { display:none; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
|
| 116 |
/* ---- conversation history (rail) ---- */
|
| 117 |
.history {
|
|
@@ -330,9 +341,15 @@ FRONTEND_HTML = r"""<!doctype html>
|
|
| 330 |
</div>
|
| 331 |
<div class="alt-sources">
|
| 332 |
<a id="uploadLink">Upload a clip</a>
|
| 333 |
-
<a id="sampleLink">Try the sample clip</a>
|
| 334 |
<input type="file" id="fileInput" accept="audio/*">
|
| 335 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 336 |
</section>
|
| 337 |
</aside>
|
| 338 |
|
|
@@ -741,14 +758,17 @@ $("fileInput").addEventListener("change", async (e) => {
|
|
| 741 |
e.target.value = "";
|
| 742 |
});
|
| 743 |
|
| 744 |
-
|
| 745 |
-
|
| 746 |
-
const
|
| 747 |
-
|
| 748 |
-
|
| 749 |
-
|
| 750 |
-
|
| 751 |
-
|
|
|
|
|
|
|
|
|
|
| 752 |
});
|
| 753 |
|
| 754 |
/* show whatever's already in the local memory on load */
|
|
|
|
| 112 |
.alt-sources a { color:var(--terracotta-deep); font-size:13px; font-weight:520; text-decoration:none; cursor:pointer; }
|
| 113 |
.alt-sources a:hover { text-decoration:underline; }
|
| 114 |
#fileInput { display:none; }
|
| 115 |
+
/* curated demo scenarios */
|
| 116 |
+
.scenarios { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:12px; }
|
| 117 |
+
.scenarios-label { font-size:12px; color:var(--muted); margin-right:2px; }
|
| 118 |
+
.chip {
|
| 119 |
+
font-family:inherit; font-size:12.5px; color:var(--terracotta-deep);
|
| 120 |
+
background:#FBEFEA; border:1px solid rgba(199,95,69,.22); border-radius:999px;
|
| 121 |
+
padding:5px 12px; cursor:pointer; transition:background .15s ease, transform .1s ease;
|
| 122 |
+
}
|
| 123 |
+
.chip:hover { background:#F6E2DA; }
|
| 124 |
+
.chip:active { transform:scale(.97); }
|
| 125 |
+
.chip:disabled { opacity:.5; cursor:not-allowed; }
|
| 126 |
|
| 127 |
/* ---- conversation history (rail) ---- */
|
| 128 |
.history {
|
|
|
|
| 341 |
</div>
|
| 342 |
<div class="alt-sources">
|
| 343 |
<a id="uploadLink">Upload a clip</a>
|
|
|
|
| 344 |
<input type="file" id="fileInput" accept="audio/*">
|
| 345 |
</div>
|
| 346 |
+
<div class="scenarios">
|
| 347 |
+
<span class="scenarios-label">Or try a story:</span>
|
| 348 |
+
<button class="chip" data-src="/sample-audio">Sara · catching up</button>
|
| 349 |
+
<button class="chip" data-src="/clip/sara-wedding">Sara · the wedding</button>
|
| 350 |
+
<button class="chip" data-src="/clip/daniel-career">Daniel · career</button>
|
| 351 |
+
<button class="chip" data-src="/clip/aunt-rose-call">Aunt Rose · a call</button>
|
| 352 |
+
</div>
|
| 353 |
</section>
|
| 354 |
</aside>
|
| 355 |
|
|
|
|
| 758 |
e.target.value = "";
|
| 759 |
});
|
| 760 |
|
| 761 |
+
document.querySelectorAll(".chip").forEach((chip) => {
|
| 762 |
+
chip.addEventListener("click", async () => {
|
| 763 |
+
const src = chip.dataset.src;
|
| 764 |
+
try {
|
| 765 |
+
const resp = await fetch(src);
|
| 766 |
+
if (!resp.ok) throw new Error("clip not found (" + resp.status + ")");
|
| 767 |
+
await runLoop(await resp.arrayBuffer());
|
| 768 |
+
} catch (err) {
|
| 769 |
+
fail("Could not load that clip: " + (err?.message ?? err));
|
| 770 |
+
}
|
| 771 |
+
});
|
| 772 |
});
|
| 773 |
|
| 774 |
/* show whatever's already in the local memory on load */
|