NaveenKumar Namachivayam commited on
Commit
113dc59
·
1 Parent(s): 19f300c

refactor: rename app from "Valluvar or AI?" to "ValluvarAI" and reorganize UI

Browse files

Rename project title from "Valluvar or AI?" to "ValluvarAI" across README, app.py, and game_engine.py. Restructure Gradio interface by moving model details into collapsible "Model Card" and "Training Details" accordions at the top. Consolidate "About" tab to focus on capabilities and acknowledgements. Add 6 new theme quick-select buttons (கல்வி, காதல், பொருள், அறம், வீரம், வாய

Files changed (5) hide show
  1. README.md +2 -2
  2. app.py +38 -20
  3. game_engine.py +1 -1
  4. hf-space/README.md +2 -2
  5. hf-space/game_engine.py +1 -1
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: Valluvar or AI?
3
  emoji: 🕉️
4
  colorFrom: red
5
  colorTo: purple
@@ -10,7 +10,7 @@ app_file: app.py
10
  pinned: false
11
  ---
12
 
13
- # Valluvar or AI? 🕉️
14
 
15
  An AI that writes new Thirukkurals in the style of Thiruvalluvar.
16
 
 
1
  ---
2
+ title: ValluvarAI
3
  emoji: 🕉️
4
  colorFrom: red
5
  colorTo: purple
 
10
  pinned: false
11
  ---
12
 
13
+ # ValluvarAI 🕉️
14
 
15
  An AI that writes new Thirukkurals in the style of Thiruvalluvar.
16
 
app.py CHANGED
@@ -1,4 +1,4 @@
1
- """Gradio UI for Thirukkural GPT - Valluvar or AI."""
2
 
3
  # Patch Jinja2 LRUCache to handle unhashable keys (gradio 4.44.0 bug).
4
  try:
@@ -48,13 +48,37 @@ from model_engine import model, stoi, itos
48
  from kural_engine import generate_kural
49
  from game_engine import new_round, check_guess
50
 
51
- with gr.Blocks(title="Valluvar or AI?") as demo:
52
- gr.Markdown("# 🕉️ Valluvar or AI?")
53
  gr.Markdown(
54
  "An AI that writes new Thirukkurals in the style of Thiruvalluvar. "
55
  "Enter a Tamil theme to generate bilingual wisdom."
56
  )
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  with gr.Tab("✨ Generate Kural"):
59
  with gr.Row():
60
  with gr.Column():
@@ -97,6 +121,13 @@ with gr.Blocks(title="Valluvar or AI?") as demo:
97
  "நட்பு",
98
  "அரசியல்",
99
  "அறன் வலியுறுத்தல்",
 
 
 
 
 
 
 
100
  ]
101
  for theme in themes:
102
  btn = gr.Button(theme)
@@ -152,20 +183,7 @@ with gr.Blocks(title="Valluvar or AI?") as demo:
152
  with gr.Tab("📊 About"):
153
  gr.Markdown(
154
  f"""
155
- ## Model Details
156
-
157
- - **Architecture:** GPT ({model.config.n_layer}L/{model.config.n_head}H/{model.config.n_embd}D)
158
- - **Parameters:** {sum(p.numel() for p in model.parameters()) / 1e6:.1f}M
159
- - **Vocabulary:** {len(stoi)} characters (Tamil + English)
160
- - **Training Data:** Thirukkural (1330 kurals with English translations)
161
- - **Tokenization:** Character-level
162
-
163
- ## Training
164
-
165
- - Steps: 10,000
166
- - Device: Apple MPS (Mac Mini)
167
- - Time: ~5 hours
168
- - Final Loss: ~1.5
169
 
170
  ## Capabilities
171
 
@@ -173,6 +191,8 @@ with gr.Blocks(title="Valluvar or AI?") as demo:
173
  - ✅ Produce coherent English translations
174
  - ✅ Handle traditional themes (virtue, politics, love)
175
  - ❌ Modern topics (science, technology) - not in training data
 
 
176
 
177
  ## Examples of AI vs Original
178
 
@@ -183,9 +203,7 @@ with gr.Blocks(title="Valluvar or AI?") as demo:
183
 
184
  ## Acknowledgements
185
 
186
- - Tamil text and English translations courtesy of
187
- [Project Madurai](https://www.projectmadurai.org/pm_etexts/utf8/pmuni0153.html)
188
- - Special thanks to Project Madurai for making the Thirukkural text and translations available.
189
  """
190
  )
191
 
 
1
+ """Gradio UI for ValluvarAI."""
2
 
3
  # Patch Jinja2 LRUCache to handle unhashable keys (gradio 4.44.0 bug).
4
  try:
 
48
  from kural_engine import generate_kural
49
  from game_engine import new_round, check_guess
50
 
51
+ with gr.Blocks(title="ValluvarAI") as demo:
52
+ gr.Markdown("# 🕉️ ValluvarAI")
53
  gr.Markdown(
54
  "An AI that writes new Thirukkurals in the style of Thiruvalluvar. "
55
  "Enter a Tamil theme to generate bilingual wisdom."
56
  )
57
 
58
+ with gr.Accordion("Model Card", open=False):
59
+ gr.Markdown(
60
+ f"""
61
+ **Architecture:** GPT ({model.config.n_layer}L/{model.config.n_head}H/{model.config.n_embd}D)
62
+ **Parameters:** {sum(p.numel() for p in model.parameters()) / 1e6:.1f}M
63
+ **Vocabulary:** {len(stoi)} characters (Tamil + English)
64
+ **Tokenization:** Character-level
65
+ **Training Steps:** 10,000
66
+ **Device:** Apple MPS (Mac Mini)
67
+ **Training Time:** ~5 hours
68
+ **Final Loss:** ~1.5
69
+ """
70
+ )
71
+
72
+ with gr.Accordion("Training Details", open=False):
73
+ gr.Markdown(
74
+ f"""
75
+ **Steps:** 10,000
76
+ **Device:** Apple MPS (Mac Mini)
77
+ **Time:** ~5 hours
78
+ **Final Loss:** ~1.5
79
+ """
80
+ )
81
+
82
  with gr.Tab("✨ Generate Kural"):
83
  with gr.Row():
84
  with gr.Column():
 
121
  "நட்பு",
122
  "அரசியல்",
123
  "அறன் வலியுறுத்தல்",
124
+ "கல்வி",
125
+ "காதல்",
126
+ "பொருள்",
127
+ "அறம்",
128
+ "வீரம்",
129
+ "வாய்மை",
130
+ "அன்பு",
131
  ]
132
  for theme in themes:
133
  btn = gr.Button(theme)
 
183
  with gr.Tab("📊 About"):
184
  gr.Markdown(
185
  f"""
186
+ ValluvarAI is a GPT model trained on the **only** Thirukkural dataset.
 
 
 
 
 
 
 
 
 
 
 
 
 
187
 
188
  ## Capabilities
189
 
 
191
  - ✅ Produce coherent English translations
192
  - ✅ Handle traditional themes (virtue, politics, love)
193
  - ❌ Modern topics (science, technology) - not in training data
194
+ - ❌ Contemporary language - only classical Tamil
195
+ - ⚠️ May contain inaccuracies or repetitions
196
 
197
  ## Examples of AI vs Original
198
 
 
203
 
204
  ## Acknowledgements
205
 
206
+ - Special thanks to [Project Madurai](https://www.projectmadurai.org/pm_etexts/utf8/pmuni0153.html) for making the Thirukkural text and translations available.
 
 
207
  """
208
  )
209
 
game_engine.py CHANGED
@@ -1,4 +1,4 @@
1
- """Game logic for Valluvar or AI guessing game."""
2
  import random
3
  from typing import Any, Final
4
 
 
1
+ """Game logic for ValluvarAI guessing game."""
2
  import random
3
  from typing import Any, Final
4
 
hf-space/README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: Valluvar or AI?
3
  emoji: 🕉️
4
  colorFrom: orange
5
  colorTo: red
@@ -10,7 +10,7 @@ app_file: app.py
10
  pinned: false
11
  ---
12
 
13
- # Valluvar or AI? 🕉️
14
 
15
  An AI that writes new Thirukkurals in the style of Thiruvalluvar.
16
 
 
1
  ---
2
+ title: ValluvarAI
3
  emoji: 🕉️
4
  colorFrom: orange
5
  colorTo: red
 
10
  pinned: false
11
  ---
12
 
13
+ # ValluvarAI 🕉️
14
 
15
  An AI that writes new Thirukkurals in the style of Thiruvalluvar.
16
 
hf-space/game_engine.py CHANGED
@@ -1,4 +1,4 @@
1
- """Game logic for Valluvar or AI guessing game."""
2
  import random
3
  from typing import Any, Final
4
 
 
1
+ """Game logic for ValluvarAI guessing game."""
2
  import random
3
  from typing import Any, Final
4