akshay4 commited on
Commit
64d15cc
·
verified ·
1 Parent(s): ced0ccd

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +74 -19
README.md CHANGED
@@ -26,14 +26,21 @@ tags:
26
 
27
  # 🎭 WitGym
28
 
29
- **One sharp line, grounded in human precedent. Then drills to sharpen it.**
30
 
31
- WitGym is a comedy coaching engine for awkward real-life moments. It extracts the **comedy structure**, retrieves analogous precedent from *The Office*, drafts constrained persona candidates, runs a **tournament ranker**, and returns one crisp line with optional coaching.
32
 
33
  **Live Space**: [build-small-hackathon/WitGym](https://huggingface.co/spaces/build-small-hackathon/WitGym)
34
 
35
- ### Why I built this
36
- Comedy has always been a personal interest — not just watching it, but understanding how a line lands. I wanted a **humor coach** for real awkward moments: paste what happened, get one sharp line, then drill on it. *The Office* felt like the right precedent library (I'm a longtime fan) — not to impersonate characters, but to learn from situations that already work. WitGym is my attempt to make that coach real under the ≤32B constraint.
 
 
 
 
 
 
 
37
 
38
  ### 30‑second demo
39
  - Paste: “My boss says he trusts me, but he rewrites every message I send.”
@@ -41,24 +48,72 @@ Comedy has always been a personal interest — not just watching it, but underst
41
  - Tap drills: **sharpen it**, **different angle**, **explain the joke**
42
 
43
  ### What makes it different
44
- - **CBR‑RAG on comedy mechanics**: retrieve by archetype, tension, and violation distance — not topic keywords
45
- - **Behavioral observation as the generative seed**: name the human move, then write from that
46
- - **Tournament ranking for landing**: truth precision, final-clause quality, domain anchoring
47
- - **Inspectable traces**: progressive disclosure in the UI; public JSONL export for Sharing is Caring
48
-
49
- ### How it works
50
- 1. **Extract** — `Qwen/Qwen3.5-27B` → `ComedyMetadata` (12 fields)
51
- 2. **Retrieve** — `BAAI/bge-small-en-v1.5` cosine pool + optional `cross-encoder/ettin-reranker-32m-v1`
52
- 3. **Generate** — 2–3 twist-gated persona candidates
53
- 4. **Rank** — fixed rubric selects the winner
54
- 5. **Compress** — optional polish to one sharp line
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  ### Evidence / badges
57
- - **Sharing is Caring** (`achievement:sharing`): [public pipeline traces](data/public_traces.jsonl) — sanitized JSONL (metadata, scene IDs, candidate stats, execution log; no Office dialogue text). Regenerate: `uv run python scripts/export_public_traces.py`
58
- - **Field Notes** (`achievement:fieldnotes`): [docs/field-notes.md](docs/field-notes.md)
59
- - **Off‑Brand UI** (`achievement:offbrand`): custom Gradio UI + streaming trace disclosure
 
 
 
 
 
60
 
61
- > **Validator**: add demo video + social post links here before submission. [Validate README](https://build-small-hackathon-field-guide.hf.space/submit)
 
 
 
 
 
62
 
63
  ### Run locally
64
 
 
26
 
27
  # 🎭 WitGym
28
 
29
+ **One sharp line, grounded in human precedent — then drills to sharpen it.**
30
 
31
+ WitGym is a comedy coaching engine for awkward real‑life moments. Paste what happened and it returns **one usable line** (not a paragraph), grounded in structurally similar precedent from *The Office* — then lets you iterate with drills: **sharpen it**, **different angle**, **explain why it works**.
32
 
33
  **Live Space**: [build-small-hackathon/WitGym](https://huggingface.co/spaces/build-small-hackathon/WitGym)
34
 
35
+ ### Why I built this (and why it’s not “just prompt it to be funny”)
36
+ Comedy has always been a personal interest — not just watching it, but reverse‑engineering why a line lands. Most “be funny” apps are vibes: you get a wall of text and no way to improve it.
37
+
38
+ WitGym treats wit like a skill you can train:
39
+ - **Extract the mechanism** (status games, tension, violation distance, subtext)
40
+ - **Retrieve precedent by structure** (not by topic keywords)
41
+ - **Draft a few constrained options**
42
+ - **Pick a winner with an explicit rubric**
43
+ - **Polish to one sharp line**
44
 
45
  ### 30‑second demo
46
  - Paste: “My boss says he trusts me, but he rewrites every message I send.”
 
48
  - Tap drills: **sharpen it**, **different angle**, **explain the joke**
49
 
50
  ### What makes it different
51
+ - **CBR‑RAG on comedy mechanics**: retrieval is driven by archetype, tension, violation distance, and subtext — not by copying jokes or matching keywords.
52
+ - **Small‑model friendly by design**: the intelligence is in the pipeline and the precedent index, not “bigger weights.”
53
+ - **Tournament ranking (not one-shot generation)**: the best line is selected by a fixed rubric (domain anchoring + final-clause punchline quality + sharpness).
54
+ - **Inspectable traces**: the UI shows what the system did (progressive disclosure), plus a sanitized public trace export.
55
+
56
+ ### System overview (high-level)
57
+
58
+ ```mermaid
59
+ flowchart TD
60
+ UserInput["User: paste awkward moment"] --> Router{"Route?"}
61
+ Router -->|banter| Banter["One-sentence banter reply"]
62
+ Router -->|coaching| CoachAsk["Ask 1 clarifying question"]
63
+ Router -->|quick_wit| Pipeline["CBR-RAG wit pipeline"]
64
+
65
+ CoachAsk --> Pipeline
66
+
67
+ Pipeline --> Extract["Pass1: Extract ComedyMetadata (Qwen3.5-27B)"]
68
+ Extract --> Retrieve["Retrieve precedent scenes (bge-small + optional rerank)"]
69
+ Retrieve --> Generate["Pass2: Draft 2–3 persona candidates"]
70
+ Generate --> Rank["Pass3: Rank by explicit rubric"]
71
+ Rank --> Compress["Pass4: Optional compression to one sharp line"]
72
+ Compress --> Output["One final line + optional explain/sharpen drills"]
73
+ ```
74
+
75
+ ### Algorithm sketch (pipeline-level)
76
+
77
+ ```mermaid
78
+ sequenceDiagram
79
+ participant UI as GradioUI
80
+ participant Engine as WitGymEngine
81
+ participant LLM as Qwen3_5_27B
82
+ participant Embed as BGE_small
83
+ participant Index as OfficeIndex
84
+
85
+ UI->>Engine: respond_stream(user_input)
86
+ Engine->>LLM: Extract ComedyMetadata (JSON)
87
+ LLM-->>Engine: metadata
88
+ Engine->>Embed: encode(metadata_query)
89
+ Embed-->>Engine: query_embedding
90
+ Engine->>Index: cosine_search + optional rerank
91
+ Index-->>Engine: precedent_scenes
92
+ Engine->>LLM: Draft candidates (persona-gated)
93
+ LLM-->>Engine: 2–3 candidates
94
+ Engine->>LLM: Rank candidates (rubric)
95
+ LLM-->>Engine: winner
96
+ Engine->>LLM: Compress winner (optional)
97
+ LLM-->>Engine: final_line
98
+ Engine-->>UI: stream phases + final_line
99
+ ```
100
 
101
  ### Evidence / badges
102
+ - **Sharing is Caring** (`achievement:sharing`): [public pipeline traces](data/public_traces.jsonl) — sanitized JSONL (metadata, scene IDs, candidate stats, execution log; no Office dialogue text). Regenerate with `uv run python scripts/export_public_traces.py`.
103
+ - **Field Notes** (`achievement:fieldnotes`): [docs/field-notes.md](docs/field-notes.md).
104
+ - **Off‑Brand UI** (`achievement:offbrand`): custom Gradio UI + streaming trace disclosure.
105
+
106
+ ### Submission links
107
+ - **Demo video**: [YouTube](https://youtu.be/enb5ua65RZM)
108
+ - **Social post**: [LinkedIn](https://www.linkedin.com/posts/akshay4b_happy-to-share-a-project-ive-been-building-ugcPost-7472401282822111232-Q_nt/)
109
+ - **Validate README**: [Build Small validator](https://build-small-hackathon-field-guide.hf.space/submit)
110
 
111
+ ### Technical details (grounded in the repo)
112
+ - **Engine entrypoint**: `witgym/engine.py` (`respond()` + `respond_stream()`).
113
+ - **Pass 1 extraction**: `witgym/extractor.py` → `ComedyMetadata` (JSON).
114
+ - **Retrieval**: `witgym/retriever.py` (cosine over an indexed embedding matrix; optional cross-encoder rerank).
115
+ - **Pass 2 generation + ranking**: `witgym/generator.py` (persona candidates + rubric ranker).
116
+ - **UI**: `app.py` (Gradio; streaming phases + progressive disclosure).
117
 
118
  ### Run locally
119