Update app.py
Browse files
app.py
CHANGED
|
@@ -385,15 +385,16 @@ if st.button("🚀 Run Topic Modeling Pipeline", type="primary", use_container_w
|
|
| 385 |
ax3.scatter(reduced_embeddings[:, 0], reduced_embeddings[:, 1], c=topics, cmap='tab10', s=150, edgecolor='k')
|
| 386 |
ax3.set_title(f"STEP 3: Clustering ({cluster_algo})", fontsize=13, fontweight='bold')
|
| 387 |
|
| 388 |
-
|
| 389 |
-
topic_sample = topics[:5] #
|
| 390 |
|
| 391 |
eq_3 = r"$\mathbf{Math (K-Means):} \quad \arg\min_S \sum ||x_i - \mu_c||^2$" if cluster_algo == "K-Means" else r"$\mathbf{Math (HDBSCAN):} \quad \text{Density} = \frac{1}{\text{core\_dist}(x)}$"
|
| 392 |
math_text_3 = (
|
| 393 |
f"{eq_3}\n"
|
| 394 |
f"Output Array Shape: ({len(topics)},) (1 Label per Doc)\n"
|
| 395 |
-
f"
|
| 396 |
)
|
|
|
|
| 397 |
ax3.text(0.5, -0.25, math_text_3, fontsize=11, ha='center', va='top', transform=ax3.transAxes, bbox=box_style)
|
| 398 |
|
| 399 |
# --------------------------------------------------
|
|
|
|
| 385 |
ax3.scatter(reduced_embeddings[:, 0], reduced_embeddings[:, 1], c=topics, cmap='tab10', s=150, edgecolor='k')
|
| 386 |
ax3.set_title(f"STEP 3: Clustering ({cluster_algo})", fontsize=13, fontweight='bold')
|
| 387 |
|
| 388 |
+
# Live Data Extraction
|
| 389 |
+
topic_sample = topics[:5] # Grabs up to the first 5
|
| 390 |
|
| 391 |
eq_3 = r"$\mathbf{Math (K-Means):} \quad \arg\min_S \sum ||x_i - \mu_c||^2$" if cluster_algo == "K-Means" else r"$\mathbf{Math (HDBSCAN):} \quad \text{Density} = \frac{1}{\text{core\_dist}(x)}$"
|
| 392 |
math_text_3 = (
|
| 393 |
f"{eq_3}\n"
|
| 394 |
f"Output Array Shape: ({len(topics)},) (1 Label per Doc)\n"
|
| 395 |
+
f"First {len(topic_sample)} Doc Assignments: {topic_sample}"
|
| 396 |
)
|
| 397 |
+
|
| 398 |
ax3.text(0.5, -0.25, math_text_3, fontsize=11, ha='center', va='top', transform=ax3.transAxes, bbox=box_style)
|
| 399 |
|
| 400 |
# --------------------------------------------------
|