refactor: Consolidate reporting logic into a hybrid report, integrate a text classification pipeline, and streamline AI client initialization and data loading.
Browse files
app.py
CHANGED
|
@@ -4,21 +4,17 @@ import numpy as np
|
|
| 4 |
import gradio as gr
|
| 5 |
import plotly.graph_objects as go
|
| 6 |
from google import genai
|
|
|
|
| 7 |
|
| 8 |
-
# ---
|
| 9 |
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
except Exception as e:
|
| 16 |
-
print(f"Gemini Init Error: {e}")
|
| 17 |
-
|
| 18 |
-
# --- PALET WARNA BANK NAGARI & CSS ---
|
| 19 |
-
# Blue: #0514DE, Light Blue: #82C3EB, Gold: #F7BD87, White: #FFFFFF
|
| 20 |
custom_css = """
|
| 21 |
-
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;700&display=swap');
|
| 22 |
body, .gradio-container { font-family: 'Plus Jakarta Sans', sans-serif !important; background-color: #FFFFFF !important; }
|
| 23 |
|
| 24 |
.nagari-header {
|
|
@@ -31,16 +27,24 @@ body, .gradio-container { font-family: 'Plus Jakarta Sans', sans-serif !importan
|
|
| 31 |
box-shadow: 0 10px 15px -3px rgba(5, 20, 222, 0.2);
|
| 32 |
}
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
.report-card {
|
| 35 |
background: #FFFFFF;
|
| 36 |
-
border-radius:
|
| 37 |
padding: 25px;
|
| 38 |
border: 1px solid #E0EDF4;
|
| 39 |
-
box-shadow: 0 4px 6px
|
| 40 |
line-height: 1.8;
|
| 41 |
}
|
| 42 |
|
| 43 |
-
.status-
|
| 44 |
background: #E0EDF4;
|
| 45 |
padding: 20px;
|
| 46 |
border-radius: 12px;
|
|
@@ -49,23 +53,27 @@ body, .gradio-container { font-family: 'Plus Jakarta Sans', sans-serif !importan
|
|
| 49 |
}
|
| 50 |
"""
|
| 51 |
|
| 52 |
-
class
|
| 53 |
def __init__(self):
|
| 54 |
self.load_data()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
def load_data(self):
|
| 57 |
-
# Proteksi loading file agar tidak error di semua ID
|
| 58 |
try:
|
| 59 |
-
|
| 60 |
-
self.df_txn
|
| 61 |
self.df_cust = pd.read_csv('customers.csv').fillna(0)
|
| 62 |
-
self.df_bal = pd.read_csv('balances_revised.csv').fillna(0)
|
| 63 |
-
self.
|
| 64 |
-
self.df_rep = pd.read_csv('repayments_revised.csv').fillna("on_time")
|
| 65 |
except Exception as e:
|
| 66 |
-
print(f"
|
| 67 |
|
| 68 |
def analyze_logic(self, customer_id):
|
|
|
|
| 69 |
cid = str(customer_id).strip().upper()
|
| 70 |
u_txn = self.df_txn[self.df_txn['customer_id'] == cid].copy()
|
| 71 |
u_bal = self.df_bal[self.df_bal['customer_id'] == cid].sort_values('month')
|
|
@@ -76,12 +84,13 @@ class ArchonFinalNagari:
|
|
| 76 |
|
| 77 |
u_info = u_info_df.iloc[0]
|
| 78 |
|
| 79 |
-
# --- FASE 4: DETERMINISTIC
|
| 80 |
income_txn = u_txn[u_txn['transaction_type'] == 'credit']['amount'].sum()
|
| 81 |
ref_income = max(income_txn, u_info['monthly_income'])
|
| 82 |
expense = u_txn[u_txn['transaction_type'] == 'debit']['amount'].sum()
|
| 83 |
er = min(expense / ref_income, 1.0) if ref_income > 0 else 1.0
|
| 84 |
|
|
|
|
| 85 |
er_s = 1.0 if er > 0.8 else (0.5 if er > 0.5 else 0.0)
|
| 86 |
bt_s = 1.0 if len(u_bal) >= 2 and u_bal.iloc[-1]['avg_balance'] < u_bal.iloc[-2]['avg_balance'] else 0.0
|
| 87 |
od_s = 1.0 if (u_bal['min_balance'] <= 0).any() else 0.0
|
|
@@ -92,116 +101,104 @@ class ArchonFinalNagari:
|
|
| 92 |
|
| 93 |
return risk_lv, score, er, u_bal, u_txn, expense, ref_income
|
| 94 |
|
| 95 |
-
def
|
| 96 |
-
#
|
| 97 |
-
|
| 98 |
-
|
| 99 |
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
if er > 0.8: msg += "Ini merupakan sinyal merah (kritis), di mana pengeluaran hampir menghabiskan seluruh pendapatan harian."
|
| 104 |
-
else: msg += "Angka ini menunjukkan manajemen pengeluaran yang cukup terkendali."
|
| 105 |
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
msg += f"- Saldo rata-rata terakhir Anda: Rp{latest_avg:,.0f}.\n"
|
| 109 |
-
if len(u_bal) > 1 and latest_avg < u_bal.iloc[-2]['avg_balance']:
|
| 110 |
-
msg += "- Terdeteksi tren penurunan saldo bulanan. Disarankan untuk menjaga saldo minimum tetap di atas batas kritis."
|
| 111 |
-
else: msg += "- Pertumbuhan saldo Anda terpantau stabil dan positif."
|
| 112 |
-
|
| 113 |
-
return msg
|
| 114 |
-
|
| 115 |
-
def get_gemini_nbo(self, risk_lv, er, cust_id, u_txn):
|
| 116 |
-
# FASE 5: NBO GENERATIVE (GEMINI)
|
| 117 |
-
if not client_ai: return None
|
| 118 |
-
merchants = u_txn.tail(3)['raw_description'].tolist()
|
| 119 |
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
def create_viz(self, u_bal, u_txn):
|
| 136 |
-
#
|
| 137 |
u_txn['m'] = u_txn['date'].dt.to_period('M').dt.to_timestamp()
|
| 138 |
cf = u_txn.groupby(['m', 'transaction_type'])['amount'].sum().unstack().fillna(0)
|
| 139 |
fig1 = go.Figure()
|
| 140 |
-
fig1.add_trace(go.Bar(x=cf.index, y=cf.get('credit', 0), name='
|
| 141 |
-
fig1.add_trace(go.Bar(x=cf.index, y=cf.get('debit', 0), name='
|
| 142 |
-
fig1.update_layout(title="
|
| 143 |
|
| 144 |
-
#
|
| 145 |
fig2 = go.Figure()
|
| 146 |
-
fig2.add_trace(go.Scatter(x=u_bal['month'], y=u_bal['avg_balance'], name='
|
| 147 |
-
fig2.update_layout(title="
|
| 148 |
return fig1, fig2
|
| 149 |
|
| 150 |
# --- UI EXECUTION ---
|
| 151 |
-
engine =
|
| 152 |
|
| 153 |
-
def
|
| 154 |
res = engine.analyze_logic(cust_id)
|
| 155 |
-
if not res:
|
|
|
|
| 156 |
|
| 157 |
risk_lv, score, er, u_bal, u_txn, exp, inc = res
|
| 158 |
-
|
| 159 |
-
ai_advice = engine.get_gemini_nbo(risk_lv, er, cust_id, u_txn)
|
| 160 |
p1, p2 = engine.create_viz(u_bal, u_txn)
|
| 161 |
|
| 162 |
-
# INTEGRASI LAPORAN (Audit + Gemini)
|
| 163 |
-
final_report = audit_report
|
| 164 |
-
if ai_advice:
|
| 165 |
-
final_report += f"\n\n---\n**💡 SARAN VIRTUAL ADVISOR (AI):**\n{ai_advice}"
|
| 166 |
-
else:
|
| 167 |
-
final_report += f"\n\n---\n*Saran Virtual Advisor saat ini sedang dalam sinkronisasi sistem perbankan.*"
|
| 168 |
-
|
| 169 |
color = "#ef4444" if risk_lv == "HIGH" else ("#f59e0b" if risk_lv == "MEDIUM" else "#10b981")
|
| 170 |
status_html = f"""
|
| 171 |
-
<div class='status-
|
| 172 |
-
<h2 style='color: #0514DE; margin:0;'>
|
| 173 |
-
<
|
| 174 |
-
<p style='margin-top:15px;'><b>Risk Score:</b> {score:.2f} | <b>Expense Ratio:</b> {er:.1%}</p>
|
| 175 |
</div>
|
| 176 |
"""
|
| 177 |
-
return status_html,
|
| 178 |
|
| 179 |
with gr.Blocks(css=custom_css) as demo:
|
| 180 |
-
# Header dengan teks putih dan tebal
|
| 181 |
gr.HTML(f"""
|
| 182 |
<div class='nagari-header'>
|
| 183 |
-
<h1
|
| 184 |
-
<p style='color: white !important; margin: 5px 0 0 0; opacity: 0.9;'>Platform Intelijen Risiko & Resiliensi
|
| 185 |
</div>
|
| 186 |
""")
|
| 187 |
|
| 188 |
with gr.Row():
|
| 189 |
with gr.Column(scale=1):
|
| 190 |
id_in = gr.Textbox(label="Customer ID", placeholder="C0001")
|
| 191 |
-
btn = gr.Button("
|
| 192 |
out_status = gr.HTML()
|
| 193 |
gr.Markdown("---")
|
| 194 |
-
gr.Markdown("ℹ️ **Info Auditor**:
|
| 195 |
|
| 196 |
with gr.Column(scale=2):
|
| 197 |
with gr.Tabs():
|
| 198 |
-
with gr.TabItem("
|
| 199 |
out_report = gr.Markdown(elem_classes="report-card")
|
| 200 |
-
with gr.TabItem("Cashflow
|
| 201 |
plot_cf = gr.Plot()
|
| 202 |
-
with gr.TabItem("
|
| 203 |
plot_bal = gr.Plot()
|
| 204 |
|
| 205 |
-
btn.click(fn=
|
| 206 |
|
| 207 |
demo.launch()
|
|
|
|
| 4 |
import gradio as gr
|
| 5 |
import plotly.graph_objects as go
|
| 6 |
from google import genai
|
| 7 |
+
from transformers import pipeline
|
| 8 |
|
| 9 |
+
# --- INITIALIZATION ---
|
| 10 |
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
| 11 |
+
# SDK 2026: Menggunakan client google-genai
|
| 12 |
+
ai_client = genai.Client(api_key=GOOGLE_API_KEY) if GOOGLE_API_KEY else None
|
| 13 |
+
|
| 14 |
+
# --- STYLING: BANK NAGARI LIGHT BLUE THEME ---
|
| 15 |
+
# Palette: #0514DE (Blue), #82C3EB (Light Blue), #F7BD87 (Gold), #FFFFFF (White)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
custom_css = """
|
| 17 |
+
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;700;800&display=swap');
|
| 18 |
body, .gradio-container { font-family: 'Plus Jakarta Sans', sans-serif !important; background-color: #FFFFFF !important; }
|
| 19 |
|
| 20 |
.nagari-header {
|
|
|
|
| 27 |
box-shadow: 0 10px 15px -3px rgba(5, 20, 222, 0.2);
|
| 28 |
}
|
| 29 |
|
| 30 |
+
/* Memastikan teks ARCHON-AI Bold & Putih */
|
| 31 |
+
.nagari-header h1 {
|
| 32 |
+
color: #FFFFFF !important;
|
| 33 |
+
font-weight: 800 !important;
|
| 34 |
+
margin: 0;
|
| 35 |
+
letter-spacing: 1px;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
.report-card {
|
| 39 |
background: #FFFFFF;
|
| 40 |
+
border-radius: 12px;
|
| 41 |
padding: 25px;
|
| 42 |
border: 1px solid #E0EDF4;
|
| 43 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
|
| 44 |
line-height: 1.8;
|
| 45 |
}
|
| 46 |
|
| 47 |
+
.status-badge {
|
| 48 |
background: #E0EDF4;
|
| 49 |
padding: 20px;
|
| 50 |
border-radius: 12px;
|
|
|
|
| 53 |
}
|
| 54 |
"""
|
| 55 |
|
| 56 |
+
class ArchonNagariEngine:
|
| 57 |
def __init__(self):
|
| 58 |
self.load_data()
|
| 59 |
+
# Model classifier di subfolder 'archon_v1'
|
| 60 |
+
try:
|
| 61 |
+
self.classifier = pipeline("text-classification", model="archon_v1")
|
| 62 |
+
except:
|
| 63 |
+
self.classifier = None
|
| 64 |
|
| 65 |
def load_data(self):
|
|
|
|
| 66 |
try:
|
| 67 |
+
# Load dari direktori utama
|
| 68 |
+
self.df_txn = pd.read_csv('transactions.csv', parse_dates=['date']).fillna("Umum")
|
| 69 |
self.df_cust = pd.read_csv('customers.csv').fillna(0)
|
| 70 |
+
self.df_bal = pd.read_csv('balances_revised.csv', parse_dates=['month']).fillna(0)
|
| 71 |
+
self.df_rep = pd.read_csv('repayments_revised.csv', parse_dates=['due_date']).fillna("on_time")
|
|
|
|
| 72 |
except Exception as e:
|
| 73 |
+
print(f"Data Loading Error: {e}")
|
| 74 |
|
| 75 |
def analyze_logic(self, customer_id):
|
| 76 |
+
# Sanitasi ID
|
| 77 |
cid = str(customer_id).strip().upper()
|
| 78 |
u_txn = self.df_txn[self.df_txn['customer_id'] == cid].copy()
|
| 79 |
u_bal = self.df_bal[self.df_bal['customer_id'] == cid].sort_values('month')
|
|
|
|
| 84 |
|
| 85 |
u_info = u_info_df.iloc[0]
|
| 86 |
|
| 87 |
+
# --- FASE 4: DETERMINISTIC CALCULATION ---
|
| 88 |
income_txn = u_txn[u_txn['transaction_type'] == 'credit']['amount'].sum()
|
| 89 |
ref_income = max(income_txn, u_info['monthly_income'])
|
| 90 |
expense = u_txn[u_txn['transaction_type'] == 'debit']['amount'].sum()
|
| 91 |
er = min(expense / ref_income, 1.0) if ref_income > 0 else 1.0
|
| 92 |
|
| 93 |
+
# Risk Score Parameters (Bobot 30/20/20/20/10)
|
| 94 |
er_s = 1.0 if er > 0.8 else (0.5 if er > 0.5 else 0.0)
|
| 95 |
bt_s = 1.0 if len(u_bal) >= 2 and u_bal.iloc[-1]['avg_balance'] < u_bal.iloc[-2]['avg_balance'] else 0.0
|
| 96 |
od_s = 1.0 if (u_bal['min_balance'] <= 0).any() else 0.0
|
|
|
|
| 101 |
|
| 102 |
return risk_lv, score, er, u_bal, u_txn, expense, ref_income
|
| 103 |
|
| 104 |
+
def build_hybrid_report(self, risk_lv, score, er, u_bal, expense, income, cid, u_txn):
|
| 105 |
+
# 1. DETERMINISTIC ANALYST (Backup & Transparansi)
|
| 106 |
+
report = f"### 📑 HASIL AUDIT ARCHON-AI\n"
|
| 107 |
+
report += f"Berdasarkan analisis perilaku transaksi, Bapak/Ibu berada pada tingkat resiliensi **{risk_lv}**.\n\n"
|
| 108 |
|
| 109 |
+
report += f"**Analisis Metrik Riil:**\n"
|
| 110 |
+
report += f"- **Risk Score ({score:.2f})**: Angka ini mencerminkan stabilitas saldo harian dan kedisiplinan kewajiban cicilan. "
|
| 111 |
+
report += f"{ 'Skor di atas 0.7 menunjukkan urgensi perbaikan gaya hidup.' if score > 0.7 else 'Skor Anda stabil.' }\n"
|
|
|
|
|
|
|
| 112 |
|
| 113 |
+
report += f"- **Expense Ratio ({er:.1%})**: Anda mengalokasikan {er:.1%} dari total daya beli Rp{income:,.0f} untuk pengeluaran. "
|
| 114 |
+
report += f"{ 'Rasio di atas 80% menandakan risiko defisit kas.' if er > 0.8 else 'Rasio di bawah 50% adalah tanda kesehatan kas yang sangat baik.' }\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
|
| 116 |
+
if not u_bal.empty:
|
| 117 |
+
latest_avg = u_bal.iloc[-1]['avg_balance']
|
| 118 |
+
report += f"- **Kondisi Tabungan**: Saldo rata-rata Rp{latest_avg:,.0f}. "
|
| 119 |
+
report += "Grafik menunjukkan tren yang perlu diperhatikan." if len(u_bal) > 1 and latest_avg < u_bal.iloc[-2]['avg_balance'] else "Tren saldo tumbuh positif."
|
| 120 |
+
|
| 121 |
+
# 2. VIRTUAL ADVISOR (GEMINI)
|
| 122 |
+
if ai_client:
|
| 123 |
+
last_merchants = u_txn.tail(2)['raw_description'].tolist()
|
| 124 |
+
prompt = f"""
|
| 125 |
+
Anda adalah Senior Virtual Advisor Bank Nagari.
|
| 126 |
+
Nasabah {cid}: Risiko {risk_lv}, Expense {er:.1%}.
|
| 127 |
+
Belanja terakhir: {last_merchants}.
|
| 128 |
+
Berikan saran finansial yang sangat hangat, tidak kaku, dan personal (panggil Bapak/Ibu).
|
| 129 |
+
Hubungkan saran Anda dengan transaksi terakhir mereka. Maks 3 kalimat.
|
| 130 |
+
"""
|
| 131 |
+
try:
|
| 132 |
+
# SDK 2026 Generate
|
| 133 |
+
response = ai_client.models.generate_content(model="gemini-1.5-flash", contents=prompt)
|
| 134 |
+
report += f"\n\n---\n**💡 SARAN VIRTUAL ADVISOR (AI):**\n{response.text}"
|
| 135 |
+
except:
|
| 136 |
+
report += f"\n\n---\n*Saran AI Advisor sedang dalam sinkronisasi. Sesuai data audit, prioritaskan efisiensi anggaran.*"
|
| 137 |
+
|
| 138 |
+
return report
|
| 139 |
|
| 140 |
def create_viz(self, u_bal, u_txn):
|
| 141 |
+
# Plot 1: Cashflow (Blue & Light Blue)
|
| 142 |
u_txn['m'] = u_txn['date'].dt.to_period('M').dt.to_timestamp()
|
| 143 |
cf = u_txn.groupby(['m', 'transaction_type'])['amount'].sum().unstack().fillna(0)
|
| 144 |
fig1 = go.Figure()
|
| 145 |
+
fig1.add_trace(go.Bar(x=cf.index, y=cf.get('credit', 0), name='Income', marker_color='#82C3EB'))
|
| 146 |
+
fig1.add_trace(go.Bar(x=cf.index, y=cf.get('debit', 0), name='Expense', marker_color='#0514DE'))
|
| 147 |
+
fig1.update_layout(title="Inflow vs Outflow", barmode='group', template='plotly_white')
|
| 148 |
|
| 149 |
+
# Plot 2: Balance History (Gold)
|
| 150 |
fig2 = go.Figure()
|
| 151 |
+
fig2.add_trace(go.Scatter(x=u_bal['month'], y=u_bal['avg_balance'], name='Avg Balance', line=dict(color='#F7BD87', width=4)))
|
| 152 |
+
fig2.update_layout(title="Pertumbuhan Saldo", template='plotly_white')
|
| 153 |
return fig1, fig2
|
| 154 |
|
| 155 |
# --- UI EXECUTION ---
|
| 156 |
+
engine = ArchonNagariEngine()
|
| 157 |
|
| 158 |
+
def run_analysis(cust_id):
|
| 159 |
res = engine.analyze_logic(cust_id)
|
| 160 |
+
if not res:
|
| 161 |
+
return "## ❌ Nasabah Tidak Ditemukan", "Cek kembali penulisan ID (C0001 - C0120).", None, None
|
| 162 |
|
| 163 |
risk_lv, score, er, u_bal, u_txn, exp, inc = res
|
| 164 |
+
hybrid_report = engine.build_hybrid_report(risk_lv, score, er, u_bal, exp, inc, cust_id, u_txn)
|
|
|
|
| 165 |
p1, p2 = engine.create_viz(u_bal, u_txn)
|
| 166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
color = "#ef4444" if risk_lv == "HIGH" else ("#f59e0b" if risk_lv == "MEDIUM" else "#10b981")
|
| 168 |
status_html = f"""
|
| 169 |
+
<div class='status-badge'>
|
| 170 |
+
<h2 style='color: #0514DE; margin:0;'>Archon Analysis Results</h2>
|
| 171 |
+
<div style='background:{color}; padding:5px 15px; border-radius:20px; color:white; font-weight:bold; display:inline-block; margin-top:10px;'>{risk_lv} RISK</div>
|
| 172 |
+
<p style='margin-top:15px; font-size:1.1em;'><b>Risk Score:</b> {score:.2f} | <b>Expense Ratio:</b> {er:.1%}</p>
|
| 173 |
</div>
|
| 174 |
"""
|
| 175 |
+
return status_html, hybrid_report, p1, p2
|
| 176 |
|
| 177 |
with gr.Blocks(css=custom_css) as demo:
|
|
|
|
| 178 |
gr.HTML(f"""
|
| 179 |
<div class='nagari-header'>
|
| 180 |
+
<h1>🛡️ **ARCHON-AI**: BANK NAGARI</h1>
|
| 181 |
+
<p style='color: white !important; margin: 5px 0 0 0; opacity: 0.9;'>Platform Intelijen Risiko & Manajemen Resiliensi Keuangan</p>
|
| 182 |
</div>
|
| 183 |
""")
|
| 184 |
|
| 185 |
with gr.Row():
|
| 186 |
with gr.Column(scale=1):
|
| 187 |
id_in = gr.Textbox(label="Customer ID", placeholder="C0001")
|
| 188 |
+
btn = gr.Button("ANALYZE CUSTOMER", variant="primary")
|
| 189 |
out_status = gr.HTML()
|
| 190 |
gr.Markdown("---")
|
| 191 |
+
gr.Markdown("ℹ️ **Info Auditor**: Skor ini menggabungkan data real-time saldo, cicilan, dan volatilitas belanja nasabah.")
|
| 192 |
|
| 193 |
with gr.Column(scale=2):
|
| 194 |
with gr.Tabs():
|
| 195 |
+
with gr.TabItem("Hybrid Intelligence Report"):
|
| 196 |
out_report = gr.Markdown(elem_classes="report-card")
|
| 197 |
+
with gr.TabItem("Cashflow Insight"):
|
| 198 |
plot_cf = gr.Plot()
|
| 199 |
+
with gr.TabItem("Balance Trend"):
|
| 200 |
plot_bal = gr.Plot()
|
| 201 |
|
| 202 |
+
btn.click(fn=run_analysis, inputs=id_in, outputs=[out_status, out_report, plot_cf, plot_bal])
|
| 203 |
|
| 204 |
demo.launch()
|