bankai-007 commited on
Commit
06e3525
·
verified ·
1 Parent(s): f0803ec

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +8 -26
src/streamlit_app.py CHANGED
@@ -11,36 +11,15 @@ st.set_page_config(page_title="NEURAL-X | AI Classifier", layout="wide", initial
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;
38
- white-space: normal !important;
39
- word-wrap: break-word !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>
@@ -90,9 +69,12 @@ with col2:
90
  result = classifier(text_input, HIDDEN_LABELS, multi_label=True)
91
  end_time = time.time()
92
 
 
93
  valid_pairs = [(l, s) for l, s in zip(result['labels'], result['scores']) if s >= 0.60]
 
 
94
  if not valid_pairs:
95
- valid_pairs = [(result['labels'][0], result['scores'][0])]
96
 
97
  st.subheader("Analysis Results")
98
  m1, m2 = st.columns(2)
 
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
+ div.stTextArea { width: 100% !important; box-sizing: border-box !important; }
18
+ div[data-baseweb="base-input"], div[data-baseweb="textarea"] { background-color: #1e293b !important; border: 1px solid rgba(255, 255, 255, 0.2) !important; border-radius: 15px !important; }
19
+ textarea { color: #ffffff !important; -webkit-text-fill-color: #ffffff !important; caret-color: #ffffff !important; }
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
+ [data-testid="stMetricValue"] { color: #38bdf8; font-size: 2rem !important; white-space: normal !important; word-wrap: break-word !important; line-height: 1.2; }
 
 
 
 
 
 
 
22
 
 
23
  .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; }
24
  .stButton > button:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(99, 102, 241, 0.4); }
25
  </style>
 
69
  result = classifier(text_input, HIDDEN_LABELS, multi_label=True)
70
  end_time = time.time()
71
 
72
+ # Dynamic Logic with 60% Threshold
73
  valid_pairs = [(l, s) for l, s in zip(result['labels'], result['scores']) if s >= 0.60]
74
+
75
+ # THE FIX: THE REJECT BUCKET
76
  if not valid_pairs:
77
+ valid_pairs = [("⚠️ Uncategorized (Low Confidence)", result['scores'][0])]
78
 
79
  st.subheader("Analysis Results")
80
  m1, m2 = st.columns(2)