Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -43,17 +43,16 @@ with gr.Blocks(theme=gr.themes.Base(), css="body { background-color: #0f0f0f; co
|
|
43 |
gpt_text = get_gpt_response(q)
|
44 |
stats = get_model_config()
|
45 |
stats_text = f"Layers: {stats['num_layers']} | Heads: {stats['num_heads']} | FFN: {stats['ffn_dim']} | Memory: {stats['memory_enabled']} | Phase: {stats['phase']} | Accuracy: {stats['accuracy']}"
|
46 |
-
|
|
|
47 |
new_row = [q, opt1, opt2, result["answer"], result["confidence"], result["reasoning"], result["context_used"]]
|
48 |
new_row_df = pd.DataFrame([new_row], columns=hist.columns)
|
49 |
-
|
50 |
updated_df = new_row_df
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
|
58 |
# 🔁 Actual retraining
|
59 |
def retrain_evo():
|
|
|
43 |
gpt_text = get_gpt_response(q)
|
44 |
stats = get_model_config()
|
45 |
stats_text = f"Layers: {stats['num_layers']} | Heads: {stats['num_heads']} | FFN: {stats['ffn_dim']} | Memory: {stats['memory_enabled']} | Phase: {stats['phase']} | Accuracy: {stats['accuracy']}"
|
46 |
+
|
47 |
+
# ✅ Safe conversation history update
|
48 |
new_row = [q, opt1, opt2, result["answer"], result["confidence"], result["reasoning"], result["context_used"]]
|
49 |
new_row_df = pd.DataFrame([new_row], columns=hist.columns)
|
50 |
+
if hist.empty:
|
51 |
updated_df = new_row_df
|
52 |
+
else:
|
53 |
+
updated_df = pd.concat([hist, new_row_df], ignore_index=True)
|
54 |
+
|
55 |
+
return evo_text, gpt_text, stats_text, updated_df
|
|
|
|
|
56 |
|
57 |
# 🔁 Actual retraining
|
58 |
def retrain_evo():
|