updated top-most markdown display
Browse files
app.py
CHANGED
|
@@ -16,16 +16,6 @@ from cluster_utils import *
|
|
| 16 |
# exploration_pipeline = joblib.load("exploration_pipeline.pkl")
|
| 17 |
|
| 18 |
#========== HELPER FUNCTIONS ==========
|
| 19 |
-
def make_json_safe(obj):
|
| 20 |
-
if isinstance(obj, dict):
|
| 21 |
-
return {str(k): make_json_safe(v) for k, v in obj.items()}
|
| 22 |
-
elif isinstance(obj, list):
|
| 23 |
-
return [make_json_safe(v) for v in obj]
|
| 24 |
-
elif hasattr(obj, "tolist"): # numpy arrays / scalars
|
| 25 |
-
return obj.tolist()
|
| 26 |
-
else:
|
| 27 |
-
return obj
|
| 28 |
-
|
| 29 |
def format_deviations_as_columns(drivers):
|
| 30 |
headers = []
|
| 31 |
cells = []
|
|
@@ -86,8 +76,7 @@ def final_clustering(file, top_features):
|
|
| 86 |
)
|
| 87 |
top_drivers = identify_top_drivers(original_centroids, top_features)
|
| 88 |
deviations_markdown = format_deviations_as_columns(top_drivers)
|
| 89 |
-
|
| 90 |
-
|
| 91 |
# debug
|
| 92 |
print("✅ Best K:", best_k, type(best_k))
|
| 93 |
print("📊 Drivers sample:", top_drivers)
|
|
@@ -103,7 +92,7 @@ def final_clustering(file, top_features):
|
|
| 103 |
#========== GRADIO INTERFACE ==========
|
| 104 |
with gr.Blocks(title="PERCEUL: Perception-Based Worker Profiler") as app:
|
| 105 |
|
| 106 |
-
gr.Markdown("# 🧠
|
| 107 |
|
| 108 |
with gr.Tab("Final Clustering"):
|
| 109 |
file_input_final = gr.File(label="Upload CSV")
|
|
|
|
| 16 |
# exploration_pipeline = joblib.load("exploration_pipeline.pkl")
|
| 17 |
|
| 18 |
#========== HELPER FUNCTIONS ==========
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
def format_deviations_as_columns(drivers):
|
| 20 |
headers = []
|
| 21 |
cells = []
|
|
|
|
| 76 |
)
|
| 77 |
top_drivers = identify_top_drivers(original_centroids, top_features)
|
| 78 |
deviations_markdown = format_deviations_as_columns(top_drivers)
|
| 79 |
+
|
|
|
|
| 80 |
# debug
|
| 81 |
print("✅ Best K:", best_k, type(best_k))
|
| 82 |
print("📊 Drivers sample:", top_drivers)
|
|
|
|
| 92 |
#========== GRADIO INTERFACE ==========
|
| 93 |
with gr.Blocks(title="PERCEUL: Perception-Based Worker Profiler") as app:
|
| 94 |
|
| 95 |
+
gr.Markdown("# 🧠 PERCEUL: Profiler of Perception and Cognitive Ergonomics in the Workplace")
|
| 96 |
|
| 97 |
with gr.Tab("Final Clustering"):
|
| 98 |
file_input_final = gr.File(label="Upload CSV")
|