Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ DATA_FILE = "synthetic_analyst_notes_10k.csv"
|
|
| 13 |
EMBED_FILE = "embeddings.npy"
|
| 14 |
|
| 15 |
# =========================
|
| 16 |
-
# 2. WALL STREET STYLING (CSS) -
|
| 17 |
# =========================
|
| 18 |
CSS = r"""
|
| 19 |
:root{
|
|
@@ -33,17 +33,28 @@ html,body{background:var(--bg); color:var(--text);}
|
|
| 33 |
.gradio-container{max-width:1200px !important; background:var(--bg) !important; color:var(--text) !important;}
|
| 34 |
h1,h2,h3,h4, label, .label, .wrap, .prose, .markdown, .md{color:var(--text) !important;}
|
| 35 |
|
| 36 |
-
/* --- NAV BAR
|
| 37 |
-
.nav{
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
.links div { opacity: 0.9; cursor: pointer; }
|
| 41 |
.links div:hover { opacity: 1; text-decoration: underline; }
|
| 42 |
|
| 43 |
-
.brand .logo{width:22px; height:22px; border-radius:7px; background:linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow:0 16px 55px rgba(43,118,255,.28);}
|
| 44 |
.spacer{flex:1;}
|
| 45 |
-
.pill{border:1px solid rgba(255,255,255,.
|
| 46 |
-
.kpi{display:flex; align-items:center; gap:10px; font-size:12px;
|
| 47 |
.dot{width:7px; height:7px; border-radius:999px; background:rgba(24,211,138,.95); box-shadow:0 0 18px rgba(24,211,138,.30);}
|
| 48 |
|
| 49 |
/* HERO & SECTIONS */
|
|
@@ -60,8 +71,12 @@ h1,h2,h3,h4, label, .label, .wrap, .prose, .markdown, .md{color:var(--text) !imp
|
|
| 60 |
.whitepanel{background:#ffffff !important; color:#111111 !important; border-radius:16px !important; border:1px solid rgba(0,0,0,.08) !important;}
|
| 61 |
.whitepanel *{color:#111111 !important;}
|
| 62 |
.gr-textbox textarea{background:#ffffff !important; color:#111111 !important; border:1px solid rgba(0,0,0,.10) !important; border-radius:16px !important;}
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
/* CARDS */
|
| 67 |
.cards{display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap:12px;}
|
|
@@ -204,7 +219,7 @@ def search(query):
|
|
| 204 |
return table_data, cards_html, pick_html
|
| 205 |
|
| 206 |
# =========================
|
| 207 |
-
# 4. QUICK STARTERS (
|
| 208 |
# =========================
|
| 209 |
def q1(): return "Companies with aggressive revenue growth >20% despite high burn rate and volatility"
|
| 210 |
def q2(): return "Distressed assets with high debt-to-equity ratios and liquidity concerns"
|
|
@@ -223,24 +238,25 @@ with gr.Blocks(css=CSS, theme=gr.themes.Base()) as demo:
|
|
| 223 |
with gr.Row(elem_classes=["pad"]):
|
| 224 |
query_in = gr.Textbox(label="Your Thesis", placeholder="e.g. 'Aggressive growth but burning cash...'", lines=2)
|
| 225 |
|
|
|
|
| 226 |
with gr.Row(elem_classes=["pad"]):
|
| 227 |
run_btn = gr.Button("🔍 SCAN MARKET", elem_classes=["runbtn"])
|
| 228 |
-
# Updated Buttons: Strategy Based
|
| 229 |
b1 = gr.Button("🔥 High Growth", elem_classes=["quick"])
|
| 230 |
b2 = gr.Button("⚠️ High Risk", elem_classes=["quick"])
|
| 231 |
b3 = gr.Button("📉 Low Margins", elem_classes=["quick"])
|
| 232 |
|
| 233 |
-
gr.HTML("<div class='section-head'><h2>Market Intelligence</h2><div class='hint'>
|
| 234 |
-
|
| 235 |
-
# Output Area
|
| 236 |
-
out_pick = gr.HTML()
|
| 237 |
|
|
|
|
| 238 |
with gr.Tabs(elem_classes=["tabs"]):
|
| 239 |
with gr.TabItem("Visual Cards"):
|
| 240 |
out_cards = gr.HTML("<div class='smallmuted'>Results will appear here...</div>")
|
| 241 |
with gr.TabItem("Data Table"):
|
| 242 |
out_table = gr.Dataframe()
|
| 243 |
|
|
|
|
|
|
|
|
|
|
| 244 |
# Interactions
|
| 245 |
run_btn.click(fn=search, inputs=query_in, outputs=[out_table, out_cards, out_pick])
|
| 246 |
b1.click(fn=q1, outputs=query_in).then(fn=search, inputs=query_in, outputs=[out_table, out_cards, out_pick])
|
|
|
|
| 13 |
EMBED_FILE = "embeddings.npy"
|
| 14 |
|
| 15 |
# =========================
|
| 16 |
+
# 2. WALL STREET STYLING (CSS) - FINAL POLISH
|
| 17 |
# =========================
|
| 18 |
CSS = r"""
|
| 19 |
:root{
|
|
|
|
| 33 |
.gradio-container{max-width:1200px !important; background:var(--bg) !important; color:var(--text) !important;}
|
| 34 |
h1,h2,h3,h4, label, .label, .wrap, .prose, .markdown, .md{color:var(--text) !important;}
|
| 35 |
|
| 36 |
+
/* --- FINAL NAV BAR FIX (ALL WHITE) --- */
|
| 37 |
+
.nav{
|
| 38 |
+
position:sticky; top:0; z-index:50;
|
| 39 |
+
display:flex; align-items:center; gap:16px;
|
| 40 |
+
padding:14px 18px;
|
| 41 |
+
background:rgba(11,18,32,.95);
|
| 42 |
+
backdrop-filter: blur(10px);
|
| 43 |
+
border-bottom:1px solid rgba(255,255,255,.15);
|
| 44 |
+
}
|
| 45 |
+
/* Force all text inside nav to be white */
|
| 46 |
+
.nav * { color: #ffffff !important; }
|
| 47 |
+
|
| 48 |
+
.brand{display:flex; align-items:center; gap:10px; font-weight:900; letter-spacing:.4px;}
|
| 49 |
+
.brand .logo{width:22px; height:22px; border-radius:7px; background:linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow:0 16px 55px rgba(43,118,255,.28);}
|
| 50 |
+
|
| 51 |
+
.links{display:flex; gap:14px; font-size:13px; font-weight: 500;}
|
| 52 |
.links div { opacity: 0.9; cursor: pointer; }
|
| 53 |
.links div:hover { opacity: 1; text-decoration: underline; }
|
| 54 |
|
|
|
|
| 55 |
.spacer{flex:1;}
|
| 56 |
+
.pill{border:1px solid rgba(255,255,255,.30); border-radius:999px; padding:7px 10px; font-size:12px; background:rgba(255,255,255,.15);}
|
| 57 |
+
.kpi{display:flex; align-items:center; gap:10px; font-size:12px;}
|
| 58 |
.dot{width:7px; height:7px; border-radius:999px; background:rgba(24,211,138,.95); box-shadow:0 0 18px rgba(24,211,138,.30);}
|
| 59 |
|
| 60 |
/* HERO & SECTIONS */
|
|
|
|
| 71 |
.whitepanel{background:#ffffff !important; color:#111111 !important; border-radius:16px !important; border:1px solid rgba(0,0,0,.08) !important;}
|
| 72 |
.whitepanel *{color:#111111 !important;}
|
| 73 |
.gr-textbox textarea{background:#ffffff !important; color:#111111 !important; border:1px solid rgba(0,0,0,.10) !important; border-radius:16px !important;}
|
| 74 |
+
|
| 75 |
+
/* BUTTONS UNIFORMITY */
|
| 76 |
+
button { height: 100% !important; min-height: 50px !important; }
|
| 77 |
+
.runbtn{border:1px solid rgba(43,118,255,.55) !important; background:linear-gradient(135deg, rgba(43,118,255,.95), rgba(0,194,255,.70)) !important; color:#ffffff !important; box-shadow:0 18px 45px rgba(43,118,255,.22) !important; font-weight: bold !important;}
|
| 78 |
+
.quick{border:1px solid rgba(0,0,0,.12) !important; background:#f0f2f5 !important; color:#111111 !important;}
|
| 79 |
+
.quick:hover{border-color:rgba(43,118,255,.35) !important; background:#ffffff !important;}
|
| 80 |
|
| 81 |
/* CARDS */
|
| 82 |
.cards{display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap:12px;}
|
|
|
|
| 219 |
return table_data, cards_html, pick_html
|
| 220 |
|
| 221 |
# =========================
|
| 222 |
+
# 4. QUICK STARTERS (STRATEGY TYPES)
|
| 223 |
# =========================
|
| 224 |
def q1(): return "Companies with aggressive revenue growth >20% despite high burn rate and volatility"
|
| 225 |
def q2(): return "Distressed assets with high debt-to-equity ratios and liquidity concerns"
|
|
|
|
| 238 |
with gr.Row(elem_classes=["pad"]):
|
| 239 |
query_in = gr.Textbox(label="Your Thesis", placeholder="e.g. 'Aggressive growth but burning cash...'", lines=2)
|
| 240 |
|
| 241 |
+
# BUTTONS ROW - All equal size now
|
| 242 |
with gr.Row(elem_classes=["pad"]):
|
| 243 |
run_btn = gr.Button("🔍 SCAN MARKET", elem_classes=["runbtn"])
|
|
|
|
| 244 |
b1 = gr.Button("🔥 High Growth", elem_classes=["quick"])
|
| 245 |
b2 = gr.Button("⚠️ High Risk", elem_classes=["quick"])
|
| 246 |
b3 = gr.Button("📉 Low Margins", elem_classes=["quick"])
|
| 247 |
|
| 248 |
+
gr.HTML("<div class='section-head'><h2>Market Intelligence</h2><div class='hint'>Similar Historical Cases & AI Pick</div></div>")
|
|
|
|
|
|
|
|
|
|
| 249 |
|
| 250 |
+
# ORDER FIXED: TABS (Visual Cards) FIRST, THEN AI PICK
|
| 251 |
with gr.Tabs(elem_classes=["tabs"]):
|
| 252 |
with gr.TabItem("Visual Cards"):
|
| 253 |
out_cards = gr.HTML("<div class='smallmuted'>Results will appear here...</div>")
|
| 254 |
with gr.TabItem("Data Table"):
|
| 255 |
out_table = gr.Dataframe()
|
| 256 |
|
| 257 |
+
# AI Pick is now below the tabs
|
| 258 |
+
out_pick = gr.HTML()
|
| 259 |
+
|
| 260 |
# Interactions
|
| 261 |
run_btn.click(fn=search, inputs=query_in, outputs=[out_table, out_cards, out_pick])
|
| 262 |
b1.click(fn=q1, outputs=query_in).then(fn=search, inputs=query_in, outputs=[out_table, out_cards, out_pick])
|