Fix Tab 2
Browse files- src/session_manager.py +7 -2
- src/ui.py +4 -4
src/session_manager.py
CHANGED
|
@@ -306,10 +306,15 @@ class HackerNewsFineTuner:
|
|
| 306 |
|
| 307 |
scored_entries.sort(key=lambda x: x["mood"].raw_score, reverse=True)
|
| 308 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 309 |
md = (f"## Hacker News Top Stories\n"
|
| 310 |
f"**Session:** {self.session_id[:6]}<br>"
|
| 311 |
-
f"**Model:** `{self.config.MODEL_NAME}
|
| 312 |
-
f"**
|
|
|
|
| 313 |
"| Vibe | Score | Title | Comments | Published |\n|---|---|---|---|---|\n")
|
| 314 |
|
| 315 |
for item in scored_entries:
|
|
|
|
| 306 |
|
| 307 |
scored_entries.sort(key=lambda x: x["mood"].raw_score, reverse=True)
|
| 308 |
|
| 309 |
+
model_name = "<unsaved>"
|
| 310 |
+
if self.last_hn_dataset:
|
| 311 |
+
model_name = f"./{self.output_dir}"
|
| 312 |
+
|
| 313 |
md = (f"## Hacker News Top Stories\n"
|
| 314 |
f"**Session:** {self.session_id[:6]}<br>"
|
| 315 |
+
f"**Base Model:** `{self.config.MODEL_NAME}`<br>"
|
| 316 |
+
f"**Tuned Model:** `{model_name}`<br>"
|
| 317 |
+
f"**Updated:** {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n\n"
|
| 318 |
"| Vibe | Score | Title | Comments | Published |\n|---|---|---|---|---|\n")
|
| 319 |
|
| 320 |
for item in scored_entries:
|
src/ui.py
CHANGED
|
@@ -119,7 +119,7 @@ def build_interface() -> gr.Blocks:
|
|
| 119 |
gr.Markdown("# π€ EmbeddingGemma Modkit: Fine-Tuning and Mood Reader")
|
| 120 |
gr.Markdown("This project provides a set of tools to fine-tune [EmbeddingGemma](https://huggingface.co/google/embeddinggemma-300m) to understand your personal taste in Hacker News titles and then use it to score and rank new articles based on their \"vibe\". The core idea is to measure the \"vibe\" of a news title by calculating the semantic similarity between its embedding and the embedding of a fixed anchor phrase, **`MY_FAVORITE_NEWS`**.<br>See [README](https://huggingface.co/spaces/google/embeddinggemma-modkit/blob/main/README.md) for more details.")
|
| 121 |
|
| 122 |
-
with gr.Tab("
|
| 123 |
|
| 124 |
# --- Model Indicator ---
|
| 125 |
gr.Dropdown(
|
|
@@ -189,7 +189,7 @@ def build_interface() -> gr.Blocks:
|
|
| 189 |
# Option B: Upload
|
| 190 |
with gr.Accordion("Option B: Upload Custom Dataset", open=False):
|
| 191 |
gr.Markdown("Upload a CSV file with columns (no header required, or header ignored if present): `Anchor`, `Positive`, `Negative`.")
|
| 192 |
-
gr.Markdown("See also: [example_training.dataset.csv](https://huggingface.co/spaces/google/embeddinggemma-modkit/blob/main/
|
| 193 |
import_file = gr.File(label="Upload Additional Dataset (.csv)", file_types=[".csv"], height=100)
|
| 194 |
|
| 195 |
# --- Step 2: Training ---
|
|
@@ -350,7 +350,7 @@ def build_interface() -> gr.Blocks:
|
|
| 350 |
outputs=[push_status]
|
| 351 |
)
|
| 352 |
|
| 353 |
-
with gr.Tab("π°
|
| 354 |
with gr.Column():
|
| 355 |
gr.Markdown(f"## Live Hacker News Feed Vibe")
|
| 356 |
gr.Markdown(f"This feed uses the current model (base or fine-tuned) to score the vibe of live Hacker News stories against **`{AppConfig.QUERY_ANCHOR}`**.")
|
|
@@ -358,7 +358,7 @@ def build_interface() -> gr.Blocks:
|
|
| 358 |
refresh_button = gr.Button("Refresh Feed π", size="lg", variant="primary")
|
| 359 |
refresh_button.click(fn=mood_feed_wrapper, inputs=[session_state], outputs=feed_output)
|
| 360 |
|
| 361 |
-
with gr.Tab("
|
| 362 |
with gr.Column():
|
| 363 |
gr.Markdown(f"## News Similarity Check")
|
| 364 |
gr.Markdown(f"Enter text to see its similarity to **`{AppConfig.QUERY_ANCHOR}`**.\n**Vibe Key:** Green = High, Red = Low")
|
|
|
|
| 119 |
gr.Markdown("# π€ EmbeddingGemma Modkit: Fine-Tuning and Mood Reader")
|
| 120 |
gr.Markdown("This project provides a set of tools to fine-tune [EmbeddingGemma](https://huggingface.co/google/embeddinggemma-300m) to understand your personal taste in Hacker News titles and then use it to score and rank new articles based on their \"vibe\". The core idea is to measure the \"vibe\" of a news title by calculating the semantic similarity between its embedding and the embedding of a fixed anchor phrase, **`MY_FAVORITE_NEWS`**.<br>See [README](https://huggingface.co/spaces/google/embeddinggemma-modkit/blob/main/README.md) for more details.")
|
| 121 |
|
| 122 |
+
with gr.Tab("βοΈ Train & Export"):
|
| 123 |
|
| 124 |
# --- Model Indicator ---
|
| 125 |
gr.Dropdown(
|
|
|
|
| 189 |
# Option B: Upload
|
| 190 |
with gr.Accordion("Option B: Upload Custom Dataset", open=False):
|
| 191 |
gr.Markdown("Upload a CSV file with columns (no header required, or header ignored if present): `Anchor`, `Positive`, `Negative`.")
|
| 192 |
+
gr.Markdown("See also: [example_training.dataset.csv](https://huggingface.co/spaces/google/embeddinggemma-modkit/blob/main/example_training_dataset.csv)<br>Example:<br>`MY_FAVORITE_NEWS,Good Title,Bad Title`")
|
| 193 |
import_file = gr.File(label="Upload Additional Dataset (.csv)", file_types=[".csv"], height=100)
|
| 194 |
|
| 195 |
# --- Step 2: Training ---
|
|
|
|
| 350 |
outputs=[push_status]
|
| 351 |
)
|
| 352 |
|
| 353 |
+
with gr.Tab("π° Live Ranked Feed"):
|
| 354 |
with gr.Column():
|
| 355 |
gr.Markdown(f"## Live Hacker News Feed Vibe")
|
| 356 |
gr.Markdown(f"This feed uses the current model (base or fine-tuned) to score the vibe of live Hacker News stories against **`{AppConfig.QUERY_ANCHOR}`**.")
|
|
|
|
| 358 |
refresh_button = gr.Button("Refresh Feed π", size="lg", variant="primary")
|
| 359 |
refresh_button.click(fn=mood_feed_wrapper, inputs=[session_state], outputs=feed_output)
|
| 360 |
|
| 361 |
+
with gr.Tab("π§ͺ Vibe Check Playground"):
|
| 362 |
with gr.Column():
|
| 363 |
gr.Markdown(f"## News Similarity Check")
|
| 364 |
gr.Markdown(f"Enter text to see its similarity to **`{AppConfig.QUERY_ANCHOR}`**.\n**Vibe Key:** Green = High, Red = Low")
|