Spaces:
Sleeping
Sleeping
Akshay Babbar commited on
Add README with Hugging Face Space YAML configuration.
Browse files
README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: WitGym
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: yellow
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: "5.0.0"
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
+
tags:
|
| 12 |
+
- comedy
|
| 13 |
+
- rag
|
| 14 |
+
- case-based-reasoning
|
| 15 |
+
- qwen
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# WitGym
|
| 19 |
+
|
| 20 |
+
Conversational wit grounded in human comedy precedent β a Case-Based Reasoning RAG (CBR-RAG) engine.
|
| 21 |
+
|
| 22 |
+
Paste a real-life awkward situation. WitGym extracts the comedy structure, retrieves analogous precedents, generates persona candidates, ranks the sharpest line, and shows every intermediate step in the logs panel.
|
| 23 |
+
|
| 24 |
+
## Run locally
|
| 25 |
+
|
| 26 |
+
```bash
|
| 27 |
+
# Install
|
| 28 |
+
uv sync # or pip install -e .
|
| 29 |
+
|
| 30 |
+
# Build index (The Office transcripts only)
|
| 31 |
+
witgym-index
|
| 32 |
+
|
| 33 |
+
# CLI (local 9B on MPS/CUDA)
|
| 34 |
+
python -m witgym.main --debug
|
| 35 |
+
|
| 36 |
+
# Gradio UI (local model)
|
| 37 |
+
python app.py
|
| 38 |
+
|
| 39 |
+
# Gradio UI via Hugging Face Inference Providers (no local 9B weights)
|
| 40 |
+
export HF_TOKEN=hf_...
|
| 41 |
+
export LLM_BACKEND=hf_api
|
| 42 |
+
python app.py
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
## Hugging Face Space secrets
|
| 46 |
+
|
| 47 |
+
| Secret | Value |
|
| 48 |
+
|--------|--------|
|
| 49 |
+
| `HF_TOKEN` | Your Hugging Face access token |
|
| 50 |
+
| `LLM_BACKEND` | `hf_api` (recommended on Spaces) |
|
| 51 |
+
|
| 52 |
+
Optional: `HF_INFERENCE_PROVIDER` (defaults to `together` for Qwen3.5-9B β required for `enable_thinking: false`), `WITGYM_INDEX_PATH`.
|
| 53 |
+
|
| 54 |
+
## Architecture
|
| 55 |
+
|
| 56 |
+
- **Small talk** (hi, who are you) β polite identity reply, no pipeline
|
| 57 |
+
- **Humour practice** β Pass 1 metadata β RAG retrieval β Pass 2 personas β rank β compress
|
| 58 |
+
|
| 59 |
+
Backend: `local` (Transformers) or `hf_api` (Inference Providers via `huggingface_hub.InferenceClient`).
|