kdallash commited on
Commit
ec35c4e
ยท
verified ยท
1 Parent(s): e9a43a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -58
app.py CHANGED
@@ -175,40 +175,60 @@ def search_hadith(query, top_k):
175
  # Custom CSS (polished, professional)
176
  # ===============================
177
  custom_css = """
178
- /* โ”€โ”€ Force light background on the whole page โ”€โ”€ */
179
- body, .gradio-container, .gradio-container * {
180
- font-family: Inter, 'Segoe UI', Tahoma, Arial, sans-serif !important;
 
 
 
 
 
 
 
 
181
  }
182
  .gradio-container {
 
 
 
 
 
 
 
183
  background-color: #f5f7fb !important;
184
- max-width: 1400px !important;
 
 
 
 
 
 
 
 
 
 
 
185
  }
186
 
187
- /* โ”€โ”€ Results wrapper โ”€โ”€ */
188
  .results { margin-top: 10px; }
189
-
190
- /* โ”€โ”€ Card โ”€โ”€ */
191
  .card {
192
  background: #ffffff !important;
193
  border-radius: 12px !important;
194
- padding: 18px !important;
195
- margin-bottom: 14px !important;
196
- box-shadow: 0 6px 20px rgba(18, 38, 63, 0.08) !important;
197
  border: 1px solid #e2e8f0 !important;
198
  color: #0f172a !important;
199
  }
200
-
201
- /* โ”€โ”€ Card header โ”€โ”€ */
202
  .card-header {
203
  display: flex !important;
204
  justify-content: space-between !important;
205
  align-items: flex-start !important;
206
  gap: 12px !important;
207
- margin-bottom: 10px !important;
208
  }
209
  .card-header .left { display:flex !important; flex-direction: column !important; gap:6px !important; }
210
-
211
- /* โ”€โ”€ Rank badge โ”€โ”€ */
212
  .index {
213
  display: inline-block !important;
214
  background: linear-gradient(90deg, #2563eb, #06b6d4) !important;
@@ -217,36 +237,25 @@ body, .gradio-container, .gradio-container * {
217
  border-radius: 20px !important;
218
  font-weight: 700 !important;
219
  font-size: 13px !important;
220
- width: fit-content !important;
221
  }
222
-
223
- /* โ”€โ”€ Title & topic โ”€โ”€ */
224
  .title {
225
  font-size: 17px !important;
226
  font-weight: 700 !important;
227
  color: #0f172a !important;
228
  }
229
- .topic {
230
- font-size: 13px !important;
231
- color: #475569 !important;
232
- margin-top: 2px !important;
233
- }
234
-
235
- /* โ”€โ”€ Right meta โ”€โ”€ */
236
- .right-meta { text-align: right !important; min-width: 100px !important; }
237
  .meta { font-size: 12px !important; color: #64748b !important; }
238
- .meta-val { color: #1e293b !important; font-weight: 600 !important; margin-left: 4px !important; }
239
-
240
- /* โ”€โ”€ Hadith text block (RTL Arabic) โ”€โ”€ */
241
  .text-rtl {
242
  direction: rtl !important;
243
  text-align: right !important;
244
- margin-top: 8px !important;
245
- margin-bottom: 10px !important;
246
  background: #f8fafc !important;
247
  border-radius: 8px !important;
248
- padding: 10px 14px !important;
249
  border-right: 4px solid #2563eb !important;
 
 
250
  }
251
  .text-rtl details > summary {
252
  cursor: pointer !important;
@@ -255,39 +264,21 @@ body, .gradio-container, .gradio-container * {
255
  line-height: 2.0 !important;
256
  list-style: none !important;
257
  }
258
- .text-rtl details > summary::-webkit-details-marker { display: none !important; }
259
- .text-rtl details > summary::before {
260
- content: "โ–ถ ";
261
- font-size: 11px;
262
- color: #2563eb;
263
- margin-left: 6px;
264
- }
265
- .text-rtl details[open] > summary::before { content: "โ–ผ "; }
266
  .text-rtl .full-text {
267
- margin-top: 10px !important;
268
  font-size: 16px !important;
269
  color: #1e293b !important;
270
  line-height: 2.0 !important;
 
 
271
  border-top: 1px solid #e2e8f0 !important;
272
- padding-top: 8px !important;
273
- }
274
-
275
- /* โ”€โ”€ Footer link โ”€โ”€ */
276
- .footer { margin-top: 10px !important; }
277
- .footer a {
278
- text-decoration: none !important;
279
- color: #2563eb !important;
280
- font-weight: 600 !important;
281
- font-size: 13px !important;
282
  }
 
283
  .footer a:hover { text-decoration: underline !important; }
284
-
285
- /* โ”€โ”€ Empty state โ”€โ”€ */
286
- .empty { font-size: 15px !important; color: #64748b !important; text-align: center !important; padding: 20px !important; }
287
-
288
- /* โ”€โ”€ Responsive โ”€โ”€ */
289
  @media (max-width: 700px) {
290
- .card-header { flex-direction: column !important; align-items: flex-start !important; }
291
  .right-meta { text-align: left !important; }
292
  }
293
  """
@@ -315,7 +306,8 @@ interface = gr.Interface(
315
  ["ุฃู‡ู…ูŠุฉ ุงู„ู†ูŠุฉ ูˆุฃุซุฑู‡ุง ููŠ ู‚ุจูˆู„ ุงู„ุฃุนู…ุงู„", 5],
316
  ["ุญู‚ูˆู‚ ุงู„ูˆุงู„ุฏูŠู†", 5]
317
  ],
318
- flagging_mode="never"
 
319
  )
320
 
321
  # ===============================
 
175
  # Custom CSS (polished, professional)
176
  # ===============================
177
  custom_css = """
178
+ /* Force light theme everywhere */
179
+ :root {
180
+ --body-background-fill: #f5f7fb !important;
181
+ --background-fill-primary: #f5f7fb !important;
182
+ --background-fill-secondary: #ffffff !important;
183
+ --border-color-primary: #e2e8f0 !important;
184
+ --color-background-primary: #f5f7fb !important;
185
+ }
186
+ body, .gradio-container {
187
+ background-color: #f5f7fb !important;
188
+ color: #0f172a !important;
189
  }
190
  .gradio-container {
191
+ max-width: 860px !important;
192
+ margin: 0 auto !important;
193
+ }
194
+ /* Force all Gradio panels white */
195
+ .gr-panel, .gr-box, .gr-form, .wrap, .panel,
196
+ div[class*="panel"], div[class*="wrap"],
197
+ .block, .gap, footer {
198
  background-color: #f5f7fb !important;
199
+ color: #0f172a !important;
200
+ border-color: #e2e8f0 !important;
201
+ }
202
+ /* Input labels */
203
+ label span, .label-wrap span {
204
+ color: #374151 !important;
205
+ }
206
+ /* Textbox and slider */
207
+ input, textarea, .gr-input, .gr-textarea {
208
+ background: #ffffff !important;
209
+ color: #0f172a !important;
210
+ border-color: #d1d5db !important;
211
  }
212
 
213
+ /* โ”€โ”€ Result Cards โ”€โ”€ */
214
  .results { margin-top: 10px; }
 
 
215
  .card {
216
  background: #ffffff !important;
217
  border-radius: 12px !important;
218
+ padding: 20px !important;
219
+ margin-bottom: 16px !important;
220
+ box-shadow: 0 4px 16px rgba(0,0,0,0.07) !important;
221
  border: 1px solid #e2e8f0 !important;
222
  color: #0f172a !important;
223
  }
 
 
224
  .card-header {
225
  display: flex !important;
226
  justify-content: space-between !important;
227
  align-items: flex-start !important;
228
  gap: 12px !important;
229
+ margin-bottom: 12px !important;
230
  }
231
  .card-header .left { display:flex !important; flex-direction: column !important; gap:6px !important; }
 
 
232
  .index {
233
  display: inline-block !important;
234
  background: linear-gradient(90deg, #2563eb, #06b6d4) !important;
 
237
  border-radius: 20px !important;
238
  font-weight: 700 !important;
239
  font-size: 13px !important;
 
240
  }
 
 
241
  .title {
242
  font-size: 17px !important;
243
  font-weight: 700 !important;
244
  color: #0f172a !important;
245
  }
246
+ .topic { font-size: 13px !important; color: #475569 !important; }
247
+ .right-meta { text-align: right !important; }
 
 
 
 
 
 
248
  .meta { font-size: 12px !important; color: #64748b !important; }
249
+ .meta-val { color: #1e293b !important; font-weight: 600 !important; }
 
 
250
  .text-rtl {
251
  direction: rtl !important;
252
  text-align: right !important;
 
 
253
  background: #f8fafc !important;
254
  border-radius: 8px !important;
255
+ padding: 12px 16px !important;
256
  border-right: 4px solid #2563eb !important;
257
+ margin: 10px 0 !important;
258
+ color: #1e293b !important;
259
  }
260
  .text-rtl details > summary {
261
  cursor: pointer !important;
 
264
  line-height: 2.0 !important;
265
  list-style: none !important;
266
  }
267
+ .text-rtl details > summary::before { content: "โ–ถ "; font-size:11px; color:#2563eb; }
268
+ .text-rtl details[open] > summary::before { content: "โ–ผ "; }
 
 
 
 
 
 
269
  .text-rtl .full-text {
 
270
  font-size: 16px !important;
271
  color: #1e293b !important;
272
  line-height: 2.0 !important;
273
+ margin-top: 10px !important;
274
+ padding-top: 10px !important;
275
  border-top: 1px solid #e2e8f0 !important;
 
 
 
 
 
 
 
 
 
 
276
  }
277
+ .footer a { color: #2563eb !important; font-weight: 600 !important; font-size:13px !important; text-decoration:none !important; }
278
  .footer a:hover { text-decoration: underline !important; }
279
+ .empty { font-size:15px !important; color:#64748b !important; text-align:center !important; padding:20px !important; }
 
 
 
 
280
  @media (max-width: 700px) {
281
+ .card-header { flex-direction: column !important; }
282
  .right-meta { text-align: left !important; }
283
  }
284
  """
 
306
  ["ุฃู‡ู…ูŠุฉ ุงู„ู†ูŠุฉ ูˆุฃุซุฑู‡ุง ููŠ ู‚ุจูˆู„ ุงู„ุฃุนู…ุงู„", 5],
307
  ["ุญู‚ูˆู‚ ุงู„ูˆุงู„ุฏูŠู†", 5]
308
  ],
309
+ flagging_mode="never",
310
+ theme=gr.themes.Default()
311
  )
312
 
313
  # ===============================