Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -175,40 +175,60 @@ def search_hadith(query, top_k):
|
|
| 175 |
# Custom CSS (polished, professional)
|
| 176 |
# ===============================
|
| 177 |
custom_css = """
|
| 178 |
-
/*
|
| 179 |
-
|
| 180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
}
|
| 182 |
.gradio-container {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
background-color: #f5f7fb !important;
|
| 184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
}
|
| 186 |
|
| 187 |
-
/* โโ
|
| 188 |
.results { margin-top: 10px; }
|
| 189 |
-
|
| 190 |
-
/* โโ Card โโ */
|
| 191 |
.card {
|
| 192 |
background: #ffffff !important;
|
| 193 |
border-radius: 12px !important;
|
| 194 |
-
padding:
|
| 195 |
-
margin-bottom:
|
| 196 |
-
box-shadow: 0
|
| 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:
|
| 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 |
-
|
| 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;
|
| 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:
|
| 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::
|
| 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;
|
| 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 |
# ===============================
|