Lilymutinda commited on
Commit
4e29cc3
·
verified ·
1 Parent(s): 737893d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -83
app.py CHANGED
@@ -7,9 +7,11 @@ from langchain_community.vectorstores import FAISS
7
  from langchain_openai import OpenAIEmbeddings, ChatOpenAI
8
  from langchain_core.documents import Document
9
 
10
- APP_TITLE = "Election Archice"
11
  APP_TAGLINE = "What Happened Last Elections."
12
 
 
 
13
  CATEGORIES = ["PRESIDENTIAL VOTE", "POLITICANS", "POLITICAL PARTIES", "WHO VIED", "WOMEN IN POLITICS", "CAMPAIGN SLOGANS"]
14
 
15
  # ---------- Core logic ----------
@@ -71,113 +73,58 @@ Context:
71
  # ---------- UI styling ----------
72
  CUSTOM_CSS = """
73
  :root{
74
- --bg:#0b0f14;
75
- --panel:#0f1620;
76
- --panel2:#0c121b;
77
- --text:#e9eef6;
78
- --muted:#9db0c6;
79
- --line:rgba(255,255,255,.08);
80
- --accent:#7c3aed; /* purple */
81
- --accent2:#22c55e;
82
- --shadow: 0 10px 30px rgba(0,0,0,.35);
83
- --radius:18px;
84
- --radius2:14px;
85
- --pad:18px;
86
  }
87
 
88
  .gradio-container{
89
- background: radial-gradient(1200px 600px at 30% -10%, rgba(124,58,237,.22), transparent 55%),
90
- radial-gradient(900px 500px at 85% 20%, rgba(34,197,94,.12), transparent 55%),
91
- var(--bg) !important;
92
  color: var(--text) !important;
93
- font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial !important;
94
- }
95
-
96
- #topbar{
97
- display:flex; align-items:center; justify-content:space-between;
98
- padding: 10px 0 4px 0;
99
  }
100
 
101
- #brand{
102
- font-size: 22px; font-weight: 800; letter-spacing: .2px;
 
 
 
103
  }
104
 
105
- #tagline{
106
- color: var(--muted);
107
- margin-top: 2px;
108
- font-size: 13px;
109
  }
110
 
111
- .card{
112
- background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
113
- border: 1px solid var(--line);
114
- border-radius: var(--radius);
115
- box-shadow: var(--shadow);
116
- padding: var(--pad);
117
- }
118
-
119
- .searchWrap{
120
- display:flex; gap:10px; align-items:center;
121
- }
122
-
123
- .pill{
124
- border: 1px solid var(--line);
125
- background: rgba(255,255,255,.04);
126
- border-radius: 999px;
127
- padding: 6px 10px;
128
- color: var(--muted);
129
- font-size: 12px;
130
- }
131
-
132
- .catBtn button{
133
- width: 100%;
134
- text-align: left;
135
  border-radius: 12px !important;
136
- border: 1px solid var(--line) !important;
137
- background: rgba(255,255,255,.03) !important;
138
- }
139
-
140
- .catBtn button:hover{
141
- border-color: rgba(124,58,237,.55) !important;
142
- background: rgba(124,58,237,.12) !important;
143
  }
144
 
145
  .primary button{
146
- border-radius: 12px !important;
147
  background: var(--accent) !important;
 
148
  border: none !important;
149
  }
150
 
151
- .primary button:hover{
152
- filter: brightness(1.05);
153
- }
154
-
155
  .soft button{
156
- border-radius: 12px !important;
157
- background: rgba(255,255,255,.06) !important;
158
  border: 1px solid var(--line) !important;
 
159
  }
160
 
161
- #archiveArt{
162
- width: 100%;
163
- height: 260px;
164
- display:flex; align-items:center; justify-content:center;
165
  border-radius: var(--radius);
166
- border: 1px dashed rgba(255,255,255,.14);
167
- background: rgba(255,255,255,.02);
168
- }
169
-
170
- #results h3{
171
- margin-top: 0;
172
  }
173
-
174
- .small{
175
- color: var(--muted);
176
- font-size: 12px;
177
- }
178
-
179
  """
180
-
181
  ARCHIVE_SVG = """
182
  <div id="archiveArt">
183
  <svg width="360" height="220" viewBox="0 0 360 220" fill="none" xmlns="http://www.w3.org/2000/svg" style="opacity:.95">
 
7
  from langchain_openai import OpenAIEmbeddings, ChatOpenAI
8
  from langchain_core.documents import Document
9
 
10
+ APP_TITLE = "Election Archive"
11
  APP_TAGLINE = "What Happened Last Elections."
12
 
13
+ with gr.Blocks(css=CUSTOM_CSS, title=APP_TITLE) as demo:
14
+
15
  CATEGORIES = ["PRESIDENTIAL VOTE", "POLITICANS", "POLITICAL PARTIES", "WHO VIED", "WOMEN IN POLITICS", "CAMPAIGN SLOGANS"]
16
 
17
  # ---------- Core logic ----------
 
73
  # ---------- UI styling ----------
74
  CUSTOM_CSS = """
75
  :root{
76
+ --bg:#ffffff;
77
+ --text:#111827;
78
+ --muted:#6b7280;
79
+ --accent:#4f46e5;
80
+ --line:#e5e7eb;
81
+ --radius:16px;
 
 
 
 
 
 
82
  }
83
 
84
  .gradio-container{
85
+ background: var(--bg) !important;
 
 
86
  color: var(--text) !important;
87
+ font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial !important;
 
 
 
 
 
88
  }
89
 
90
+ h1{
91
+ font-size: 48px !important;
92
+ font-weight: 800 !important;
93
+ line-height: 1.1 !important;
94
+ letter-spacing: -1px;
95
  }
96
 
97
+ h3{
98
+ font-size: 18px !important;
99
+ color: var(--muted) !important;
100
+ font-weight: 400 !important;
101
  }
102
 
103
+ button{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  border-radius: 12px !important;
105
+ padding: 12px 20px !important;
106
+ font-weight: 600 !important;
 
 
 
 
 
107
  }
108
 
109
  .primary button{
 
110
  background: var(--accent) !important;
111
+ color: white !important;
112
  border: none !important;
113
  }
114
 
 
 
 
 
115
  .soft button{
116
+ background: white !important;
 
117
  border: 1px solid var(--line) !important;
118
+ color: var(--text) !important;
119
  }
120
 
121
+ .card{
122
+ border: 1px solid var(--line);
 
 
123
  border-radius: var(--radius);
124
+ padding: 24px;
125
+ background: white;
 
 
 
 
126
  }
 
 
 
 
 
 
127
  """
 
128
  ARCHIVE_SVG = """
129
  <div id="archiveArt">
130
  <svg width="360" height="220" viewBox="0 0 360 220" fill="none" xmlns="http://www.w3.org/2000/svg" style="opacity:.95">