Skip to content

Commit a5623a1

Browse files
committed
up
1 parent 5f63fa4 commit a5623a1

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

streamlit_fronted.py

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def get_cluster_status():
6363

6464
# --- CLUSTER MANAGEMENT TAB ---
6565
def cluster_tab():
66-
st.header("Gestión del Clúster Ray Distribuido")
66+
st.header("🖧 Clúster de Ray")
6767

6868
# Add refresh button for cluster state
6969
col1, col2 = st.columns([3, 1])
@@ -110,7 +110,7 @@ def cluster_tab():
110110
st.warning(f"Could not fetch worker details (timeout or error): {e}")
111111

112112
# Create comprehensive cluster table
113-
st.markdown("### 📋 Nodos del Clúster")
113+
st.markdown("### 🖧 Nodos")
114114

115115
# Prepare table data
116116
table_data = []
@@ -125,14 +125,14 @@ def cluster_tab():
125125
head_cpu_raw = head_node.get("Resources", {}).get("CPU", 2.0) if head_node else 2.0
126126
head_cpu = min(head_cpu_raw, 8) # Cap at 8 cores for more realistic display
127127
head_memory = head_node.get("Resources", {}).get("memory", 4e9) / 1e9 if head_node else 4.0
128-
head_status = "🟢 Activo" if head_node and head_node.get("Alive") else "🔴 Inactivo"
128+
head_status = " Activo" if head_node and head_node.get("Alive") else " Inactivo"
129129

130130
table_data.append({
131-
"Nodo": "🎯 Head Node (ray-head)",
131+
"Nodo": "1️⃣ Head Node (ray-head)",
132132
"CPU": f"{head_cpu}",
133133
"RAM (GB)": f"{head_memory:.1f}",
134134
"Estado": head_status,
135-
"Tipo": "Coordinador Principal"
135+
"Tipo": "Líder"
136136
})
137137

138138
# Add worker nodes - use same logic as metrics (all Ray nodes except head)
@@ -149,15 +149,15 @@ def cluster_tab():
149149
worker_cpu = min(worker['resources'].get('CPU', 4), 4)
150150
worker_memory = worker['resources'].get('memory', 2e9) / 1e9
151151

152-
status_icon = "🟢"
152+
status_icon = ""
153153
status_text = "Activo"
154154

155155
table_data.append({
156156
"Nodo": f"⚙️ Worker {worker['number']} ({worker['name']})",
157157
"CPU": f"{worker_cpu}",
158158
"RAM (GB)": f"{worker_memory:.1f}",
159159
"Estado": f"{status_icon} {status_text}",
160-
"Tipo": "Nodo de Procesamiento"
160+
"Tipo": "Trabajador"
161161
})
162162
else:
163163
# Fallback: use Ray cluster info if API data not available
@@ -171,8 +171,8 @@ def cluster_tab():
171171
"Nodo": f"⚙️ Worker {i+1} (ray-worker-{i+1})",
172172
"CPU": f"{worker_cpu}",
173173
"RAM (GB)": f"{worker_memory:.1f}",
174-
"Estado": "🟢 Activo",
175-
"Tipo": "Nodo de Procesamiento"
174+
"Estado": " Activo",
175+
"Tipo": "Trabajador"
176176
})
177177

178178
# Display table with current worker count info
@@ -183,7 +183,7 @@ def cluster_tab():
183183
st.warning("No se pudo obtener información de los nodos del clúster")
184184

185185
# Detailed cluster information
186-
with st.expander("🔍 Información Detallada del Clúster"):
186+
with st.expander("📥 Información del Clúster"):
187187
st.json(cluster_status)
188188

189189
else:
@@ -192,8 +192,8 @@ def cluster_tab():
192192

193193
# --- TRAINING TAB ---
194194
def training_tab():
195-
st.header("🚀 Entrenamiento Distribuido de Modelos ML")
196-
st.markdown("Suba archivos CSV/JSON para procesamiento y entrenamiento distribuido en el clúster Ray")
195+
st.header("🏋🏻‍♀️ Entrenamiento de Modelos de Maching Learning de forma distribuida.")
196+
st.markdown("Seleccione el datasets deseados en formato CSV/JSON para realizar el procesamiento y entrenamiento distribuido de modelos de ML en el clúster de Ray.")
197197

198198
# Check for existing trained models (no longer shown in UI, but still fetched for prediction section)
199199
try:
@@ -235,6 +235,8 @@ def training_tab():
235235
else:
236236
st.write(f" - {model_name}: Training completed")
237237

238+
st.info("💡 Para realizar el entrenamiento primero suba el datasets deseado y luego seleccione la variable objetivo...")
239+
238240
# Step 1: File Upload
239241
st.subheader("1. 📁 Subir Archivos CSV/JSON")
240242

@@ -393,7 +395,7 @@ def training_tab():
393395
# Step 2: File Configuration and Training
394396
# Only show configuration if files are successfully uploaded and have valid data
395397
successfully_uploaded_files = {k: v for k, v in st.session_state['uploaded_files'].items()
396-
if v and 'rows' in v and 'columns' in v}
398+
if v and 'rows' in v and 'columns' in v}
397399

398400
# Verify that uploaded files are still accessible in the backend
399401
if successfully_uploaded_files:
@@ -417,7 +419,7 @@ def training_tab():
417419
del st.session_state['file_configs'][missing_file]
418420
# Update the list of successfully uploaded files
419421
successfully_uploaded_files = {k: v for k, v in st.session_state['uploaded_files'].items()
420-
if v and 'rows' in v and 'columns' in v}
422+
if v and 'rows' in v and 'columns' in v}
421423
if not successfully_uploaded_files:
422424
st.info("💡 Por favor, vuelve a subir los archivos.")
423425
elif missing_files:
@@ -698,7 +700,7 @@ def convert_algorithm_name(algo_name, task_type):
698700
# Additional error handling: check if cluster is healthy
699701
cluster_status = get_cluster_status()
700702
if "error" in cluster_status:
701-
st.error("🔴 El clúster Ray no está disponible. Verifica que los contenedores estén ejecutándose.")
703+
st.error(" El clúster Ray no está disponible. Verifica que los contenedores estén ejecutándose.")
702704
st.info("Para resolver el problema, ejecuta: `docker-compose restart`")
703705
else:
704706
st.info("El clúster está funcionando. El error puede ser temporal. Intenta nuevamente en unos momentos.")
@@ -721,7 +723,7 @@ def convert_algorithm_name(algo_name, task_type):
721723
- Revisa los logs del backend para más detalles: `docker-compose logs backend`
722724
""")
723725
else:
724-
st.error(f"🔴 Problema de conectividad: {backend_status['message']}")
726+
st.error(f" Problema de conectividad: {backend_status['message']}")
725727
st.markdown("""
726728
**Para solucionar el problema:**
727729
1. Asegúrate que Docker esté ejecutándose
@@ -734,7 +736,7 @@ def convert_algorithm_name(algo_name, task_type):
734736

735737
# --- PREDICTION TAB ---
736738
def prediction_tab():
737-
st.header("🔮 Model Prediction Interface")
739+
st.header("🚀 Predicciones con los modelos entrenados.")
738740
# Get uploaded files and trained models
739741
try:
740742
files_response = requests.get('http://localhost:8000/uploaded_files', timeout=10)
@@ -854,7 +856,7 @@ def prediction_tab():
854856
f"{feature_name}",
855857
key=f"predict_{feature_name}_{selected_dataset}"
856858
)
857-
if st.button("🔮 Predict", use_container_width=True):
859+
if st.button("🚀 Predict", use_container_width=True):
858860
# Prepare feature dict for prediction
859861
try:
860862
features = {k: (float(v) if v.replace('.','',1).isdigit() else v) for k,v in feature_inputs.items() if v != ''}
@@ -926,10 +928,10 @@ def debug_section():
926928
st.json(cluster_status)
927929

928930
# --- MAIN APP LAYOUT WITH TABS ---
929-
st.title("Distributed ML Platform - Visual Interface")
931+
st.title("Plataforma distribuida de entrenamiento supervisado")
930932

931933
# Create tabs
932-
tab1, tab2, tab3 = st.tabs(["🏗️ Cluster", "🚀 Training", "🔮 Prediction"])
934+
tab1, tab2, tab3 = st.tabs(["🖧 Cluster", "🏋🏻‍♀️ Entrenamiento", "🚀 Predicción"])
933935

934936
with tab1:
935937
cluster_tab()
@@ -942,15 +944,15 @@ def debug_section():
942944

943945
# Show backend status in sidebar
944946
st.sidebar.markdown("---")
945-
st.sidebar.subheader("Estado del Backend API")
947+
st.sidebar.subheader("Estado de la API (backend)")
946948
try:
947949
response = requests.get('http://localhost:8000/health', timeout=2)
948950
if response.status_code == 200:
949-
st.sidebar.success("🟢 API disponible")
951+
st.sidebar.success(" API disponible")
950952
else:
951953
st.sidebar.warning("⚠️ API con problemas")
952954
except Exception:
953-
st.sidebar.error("🔴 API no disponible")
955+
st.sidebar.error(" API no disponible")
954956

955957
# Show debug tools
956958
debug_section()

0 commit comments

Comments
 (0)