HugoNeres commited on
Commit
f406e5d
·
verified ·
1 Parent(s): 46859b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -39,11 +39,25 @@ except FileNotFoundError:
39
  # --- TABS ---
40
  tab1, tab2, tab3, tab4 = st.tabs(["I. Diagnóstico", "II. Avaliação de Modelos", "IV. Clusterização", "V. Recomendações"])
41
 
42
- # ... (ABA I MANTIDA IGUAL) ...
 
 
43
  with tab1:
44
- st.header("I. Diagnóstico Inicial")
45
- st.metric("Total Clientes", len(df))
46
- # ... (Seu código da Aba 1 aqui) ...
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  # =========================================================
49
  # ABA II: AVALIAÇÃO INSTANTÂNEA (OTIMIZADA)
 
39
  # --- TABS ---
40
  tab1, tab2, tab3, tab4 = st.tabs(["I. Diagnóstico", "II. Avaliação de Modelos", "IV. Clusterização", "V. Recomendações"])
41
 
42
+ # =========================================================
43
+ # ABA I (Mantida igual - Diagnóstico)
44
+ # =========================================================
45
  with tab1:
46
+ st.header("I. Diagnóstico Inicial e Tratamento")
47
+ st.markdown("Visão geral da base de dados processada.")
48
+
49
+ col1, col2 = st.columns(2)
50
+ col1.metric("Total de Clientes", f"{len(df):,}")
51
+ col2.metric("Taxa Global de Inadimplência", f"{df['loan_status'].mean():.1%}")
52
+
53
+ st.subheader("Análise Interativa")
54
+ var_selected = st.selectbox("Escolha a Variável:", df.columns.drop('loan_status'))
55
+
56
+ if pd.api.types.is_numeric_dtype(df[var_selected]) and df[var_selected].nunique() > 10:
57
+ fig = px.histogram(df, x=var_selected, color="loan_status", barmode="overlay", title=f"Distribuição: {var_selected}")
58
+ else:
59
+ fig = px.histogram(df, x=var_selected, color="loan_status", barmode="group", title=f"Contagem: {var_selected}")
60
+ st.plotly_chart(fig, use_container_width=True)
61
 
62
  # =========================================================
63
  # ABA II: AVALIAÇÃO INSTANTÂNEA (OTIMIZADA)