bankai-007 commited on
Commit
f0803ec
·
verified ·
1 Parent(s): 4f1aa3d

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +15 -12
src/streamlit_app.py CHANGED
@@ -6,28 +6,32 @@ import pandas as pd
6
  import time
7
 
8
  # --- UI CONFIGURATION ---
9
- st.set_page_config(page_title="Multi - Label News Classifier", layout="wide", initial_sidebar_state="expanded")
10
 
11
  # --- CUSTOM CSS ---
12
  st.markdown("""
13
  <style>
 
14
  .stApp { background: radial-gradient(circle at top right, #1e293b, #0f172a); color: #f8fafc; }
15
  h1 { font-family: 'Inter', sans-serif; font-weight: 800; background: -webkit-linear-gradient(#38bdf8, #818cf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: -1px; }
16
 
17
- /* FIX 1: STOP TEXT AREA OVERFLOW */
18
  div.stTextArea {
19
  width: 100% !important;
20
  box-sizing: border-box !important;
21
  }
22
- div[data-baseweb="textarea"] {
23
- background: rgba(255, 255, 255, 0.03) !important;
24
- border: 1px solid rgba(255, 255, 255, 0.1) !important;
25
  border-radius: 15px !important;
26
- backdrop-filter: blur(10px);
27
  }
28
- textarea { color: white !important; }
 
 
 
 
29
 
30
- /* FIX 2: FORCE FULL LABEL NAMES TO WRAP, NOT TRUNCATE */
31
  [data-testid="stMetricValue"] {
32
  color: #38bdf8;
33
  font-size: 2rem !important;
@@ -36,6 +40,7 @@ st.markdown("""
36
  line-height: 1.2;
37
  }
38
 
 
39
  .stButton > button { width: 100%; background: linear-gradient(90deg, #6366f1 0%, #a855f7 100%); color: white; border: none; padding: 0.75rem; border-radius: 12px; font-weight: 600; transition: all 0.3s ease; text-transform: uppercase; letter-spacing: 1px; }
40
  .stButton > button:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(99, 102, 241, 0.4); }
41
  </style>
@@ -66,8 +71,8 @@ with st.sidebar:
66
  st.info(f"**{item['label']}**\n\n{item['text'][:50]}...")
67
 
68
  # --- MAIN UI ---
69
- st.title("Multi - Label News Classifier")
70
- st.write("#### ENews Article analysis powered by Deep Learning.")
71
 
72
  col1, col2 = st.columns([1.2, 0.8], gap="large")
73
 
@@ -92,7 +97,6 @@ with col2:
92
  st.subheader("Analysis Results")
93
  m1, m2 = st.columns(2)
94
 
95
- # Metric will now properly wrap text instead of "..."
96
  m1.metric("Top Category", valid_pairs[0][0])
97
  m2.metric("Inference Time", f"{round(end_time - start_time, 2)}s")
98
 
@@ -105,7 +109,6 @@ with col2:
105
  color="Confidence", color_continuous_scale="Tealgrn",
106
  template="plotly_dark")
107
 
108
- # FIX 3: Force Plotly to give long labels enough margin space
109
  fig.update_yaxes(automargin=True)
110
  fig.update_layout(paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0)')
111
  st.plotly_chart(fig, use_container_width=True)
 
6
  import time
7
 
8
  # --- UI CONFIGURATION ---
9
+ st.set_page_config(page_title="NEURAL-X | AI Classifier", layout="wide", initial_sidebar_state="expanded")
10
 
11
  # --- CUSTOM CSS ---
12
  st.markdown("""
13
  <style>
14
+ /* Main Background */
15
  .stApp { background: radial-gradient(circle at top right, #1e293b, #0f172a); color: #f8fafc; }
16
  h1 { font-family: 'Inter', sans-serif; font-weight: 800; background: -webkit-linear-gradient(#38bdf8, #818cf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: -1px; }
17
 
18
+ /* THE FIX: Force the text area to be immune to Light Mode */
19
  div.stTextArea {
20
  width: 100% !important;
21
  box-sizing: border-box !important;
22
  }
23
+ div[data-baseweb="base-input"], div[data-baseweb="textarea"] {
24
+ background-color: #1e293b !important; /* Hardcoded dark background */
25
+ border: 1px solid rgba(255, 255, 255, 0.2) !important;
26
  border-radius: 15px !important;
 
27
  }
28
+ textarea {
29
+ color: #ffffff !important; /* Hardcoded white text */
30
+ -webkit-text-fill-color: #ffffff !important; /* Forces Safari/Chrome to obey */
31
+ caret-color: #ffffff !important; /* Makes the blinking typing cursor visible */
32
+ }
33
 
34
+ /* Wrap Metric Text */
35
  [data-testid="stMetricValue"] {
36
  color: #38bdf8;
37
  font-size: 2rem !important;
 
40
  line-height: 1.2;
41
  }
42
 
43
+ /* Button Styling */
44
  .stButton > button { width: 100%; background: linear-gradient(90deg, #6366f1 0%, #a855f7 100%); color: white; border: none; padding: 0.75rem; border-radius: 12px; font-weight: 600; transition: all 0.3s ease; text-transform: uppercase; letter-spacing: 1px; }
45
  .stButton > button:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(99, 102, 241, 0.4); }
46
  </style>
 
71
  st.info(f"**{item['label']}**\n\n{item['text'][:50]}...")
72
 
73
  # --- MAIN UI ---
74
+ st.title("NEURAL-X CLASSIFIER")
75
+ st.write("#### Enterprise-grade semantic analysis powered by Deep Learning.")
76
 
77
  col1, col2 = st.columns([1.2, 0.8], gap="large")
78
 
 
97
  st.subheader("Analysis Results")
98
  m1, m2 = st.columns(2)
99
 
 
100
  m1.metric("Top Category", valid_pairs[0][0])
101
  m2.metric("Inference Time", f"{round(end_time - start_time, 2)}s")
102
 
 
109
  color="Confidence", color_continuous_scale="Tealgrn",
110
  template="plotly_dark")
111
 
 
112
  fig.update_yaxes(automargin=True)
113
  fig.update_layout(paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0)')
114
  st.plotly_chart(fig, use_container_width=True)