diff --git a/dashboard/dashboard.py b/dashboard/dashboard.py index 547579a..6d73288 100644 --- a/dashboard/dashboard.py +++ b/dashboard/dashboard.py @@ -1,13 +1,18 @@ from flask import Flask, render_template +from model.journal import read_journal_entries from model.memory import load_dreams from model.tokenizer import Tokenizer +from model.abstraction import cluster_vocab from context.context import load_context import os +import time app = Flask(__name__) tokenizer = Tokenizer() +next_cycle_time = time.time() + 900 # Example: 15 minutes from now + def load_loss_data(): path = "data/logs/loss.log" @@ -18,17 +23,36 @@ def load_loss_data(): return [float(line.strip().split(",")[1]) for line in lines[-50:]] +def update_next_cycle(seconds): + global next_cycle_time + next_cycle_time = time.time() + seconds + + @app.route("/") def index(): dreams = load_dreams() top_dreams = dreams[:5] memory_size = len(load_context()) loss_data = load_loss_data() + remaining = max(0, int(next_cycle_time - time.time())) return render_template("index.html", vocab_size=len(tokenizer.vocab), top_dreams=top_dreams, memory_size=memory_size, - loss_data=loss_data) + loss_data=loss_data, + next_cycle=remaining) + + +@app.route("/journal") +def journal(): + entries = read_journal_entries() + return render_template("journal.html", entries=entries) + + +@app.route("/concepts") +def concepts(): + clusters = cluster_vocab(n_clusters=10) + return render_template("concepts.html", clusters=clusters) def run_dashboard(): diff --git a/dashboard/templates/concepts.html b/dashboard/templates/concepts.html new file mode 100644 index 0000000..81154fc --- /dev/null +++ b/dashboard/templates/concepts.html @@ -0,0 +1,42 @@ + + + + + Ruby's Concepts + + + +

🧠 Ruby's Concept Clusters

+ + {% for cluster_id, words in clusters.items() %} +
+

Concept {{ cluster_id }}

+ +
+ {% endfor %} + + diff --git a/dashboard/templates/index.html b/dashboard/templates/index.html index e6b323b..e78c99c 100644 --- a/dashboard/templates/index.html +++ b/dashboard/templates/index.html @@ -1,24 +1,80 @@ - + + Ruby's Dashboard + -

Ruby is running

-

Vocabulary Size: {{ vocab_size }}

-

Memory Entries: {{ memory_size }}

+

Ruby is Running 🧠

+ +
+

⏳ Next Cycle Countdown

+

{{ next_cycle }} seconds

+
+ + + +
+

Vocabulary Size: {{ vocab_size }}

+

Memory Entries: {{ memory_size }}

+
+ +
+ +
+

🏆 Highest Scoring Dreams

+ +
+ +
+ +
+

📉 Recent Loss

+ +
-

🏆 Highest Scoring Dreams

- -

📉 Recent Loss

- diff --git a/dashboard/templates/journal.html b/dashboard/templates/journal.html new file mode 100644 index 0000000..ef6c8ac --- /dev/null +++ b/dashboard/templates/journal.html @@ -0,0 +1,30 @@ + + + + + Ruby's Journal + + + +

📓 Ruby's Journal

+ + {% for entry in entries %} +
{{ entry }}
+ {% endfor %} + +