Update app.py
Browse files
app.py
CHANGED
@@ -330,11 +330,28 @@ elif page== "📊 Tabular Data":
|
|
330 |
top_factors = "\n".join([f"- {feat}: {round(value, 2)} impact" for feat, value in top_features])
|
331 |
|
332 |
# 🎭 **Streamlit UI**
|
333 |
-
|
334 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
with st.spinner("🤖 Analyzing..."):
|
|
|
336 |
try:
|
337 |
-
ai_output =
|
338 |
**Based on the provided feature impacts, here's an interpretation of the model's decision-making process:**
|
339 |
|
340 |
### **Most influential factors:**
|
@@ -361,11 +378,11 @@ elif page== "📊 Tabular Data":
|
|
361 |
|
362 |
These characteristics may indicate that the patient has chronic or complex health issues, incomplete recovery, or inadequate post-discharge care, increasing their risk of readmission.
|
363 |
"""
|
364 |
-
|
365 |
# 🎭 **Show AI Response in a Stylish Chat Format**
|
366 |
with st.chat_message("assistant"):
|
367 |
st.markdown(f"**💡 AI Explanation:**\n\n{ai_output}")
|
368 |
-
|
369 |
except Exception as e:
|
370 |
st.error(f"⚠️ Error retrieving response: {e}")
|
371 |
st.stop()
|
|
|
330 |
top_factors = "\n".join([f"- {feat}: {round(value, 2)} impact" for feat, value in top_features])
|
331 |
|
332 |
# 🎭 **Streamlit UI**
|
333 |
+
import streamlit as st
|
334 |
+
import time
|
335 |
+
import random
|
336 |
+
# Título estilizado
|
337 |
+
st.markdown("""
|
338 |
+
<h1 style='text-align: center; color: #2c3e50;'>🩺 AI-Powered Patient Readmission Analysis</h1>
|
339 |
+
<hr style='border: 2px solid #3498db;'>
|
340 |
+
""", unsafe_allow_html=True)
|
341 |
+
|
342 |
+
# Função para animar uma aranha
|
343 |
+
placeholder = st.empty()
|
344 |
+
|
345 |
+
for i in range(40): # 4 segundos (40 iterações de 0.1s)
|
346 |
+
spider_position = " " * random.randint(1, 20) + "🕷️"
|
347 |
+
placeholder.markdown(f"<h2 style='text-align: center;'>{spider_position}</h2>", unsafe_allow_html=True)
|
348 |
+
time.sleep(0.1)
|
349 |
+
placeholder.empty()
|
350 |
+
|
351 |
with st.spinner("🤖 Analyzing..."):
|
352 |
+
time.sleep(2) # Simular carregamento
|
353 |
try:
|
354 |
+
ai_output = """
|
355 |
**Based on the provided feature impacts, here's an interpretation of the model's decision-making process:**
|
356 |
|
357 |
### **Most influential factors:**
|
|
|
378 |
|
379 |
These characteristics may indicate that the patient has chronic or complex health issues, incomplete recovery, or inadequate post-discharge care, increasing their risk of readmission.
|
380 |
"""
|
381 |
+
|
382 |
# 🎭 **Show AI Response in a Stylish Chat Format**
|
383 |
with st.chat_message("assistant"):
|
384 |
st.markdown(f"**💡 AI Explanation:**\n\n{ai_output}")
|
385 |
+
|
386 |
except Exception as e:
|
387 |
st.error(f"⚠️ Error retrieving response: {e}")
|
388 |
st.stop()
|