kdallash commited on
Commit
3d26bd0
·
verified ·
1 Parent(s): 632b4ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -12
app.py CHANGED
@@ -29,7 +29,7 @@ with open("data/anchor_dict.pkl", "rb") as f:
29
  with open("data/unique_anchor_texts.pkl", "rb") as f:
30
  unique_anchor_texts = pickle.load(f)
31
 
32
- model = SentenceTransformer("sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2")
33
  model.max_seq_length = 512
34
 
35
  # Quick dimension check
@@ -177,10 +177,8 @@ def search_hadith(query, top_k):
177
  custom_css = """
178
  /* Page */
179
  body { background-color: #f5f7fb; font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif; }
180
-
181
  /* Container (results) keeps RTL for hadith text blocks but LTR for metadata */
182
  .results { margin-top: 10px; }
183
-
184
  /* Card */
185
  .card {
186
  background: #ffffff;
@@ -190,7 +188,6 @@ body { background-color: #f5f7fb; font-family: Inter, "Segoe UI", Tahoma, Arial,
190
  box-shadow: 0 6px 20px rgba(18, 38, 63, 0.06);
191
  border: 1px solid rgba(20, 43, 74, 0.03);
192
  }
193
-
194
  /* Header layout */
195
  .card-header {
196
  display: flex;
@@ -199,7 +196,6 @@ body { background-color: #f5f7fb; font-family: Inter, "Segoe UI", Tahoma, Arial,
199
  gap: 12px;
200
  margin-bottom: 10px;
201
  }
202
-
203
  .card-header .left { display:flex; flex-direction: column; gap:6px; }
204
  .index {
205
  display:inline-block;
@@ -211,29 +207,24 @@ body { background-color: #f5f7fb; font-family: Inter, "Segoe UI", Tahoma, Arial,
211
  font-size: 13px;
212
  width: fit-content;
213
  }
214
-
215
  .title {
216
  font-size: 18px;
217
  font-weight: 700;
218
  color: #0f172a;
219
  }
220
-
221
  .topic {
222
  font-size: 13px;
223
  color: #475569;
224
  margin-top: 4px;
225
  }
226
-
227
  /* Right meta */
228
  .right-meta { text-align: right; min-width: 120px; }
229
  .meta { font-size: 12px; color: #6b7280; }
230
  .meta-val { color: #0f172a; font-weight: 600; margin-left: 6px; }
231
-
232
  /* Hadith text: keep RTL and readable */
233
  .text-rtl { direction: rtl; margin-top: 6px; margin-bottom: 10px; }
234
  .text-rtl .summary { cursor: pointer; font-size: 16px; color: #111827; line-height: 1.9; }
235
  .text-rtl .full-text { margin-top: 8px; font-size: 16px; color: #111827; line-height: 1.9; }
236
-
237
  /* Footer link */
238
  .footer { margin-top: 12px; }
239
  .footer a {
@@ -241,10 +232,8 @@ body { background-color: #f5f7fb; font-family: Inter, "Segoe UI", Tahoma, Arial,
241
  color: #2563eb; font-weight: 600;
242
  }
243
  .footer a:hover { text-decoration: underline; }
244
-
245
  /* Empty state */
246
  .empty { font-size: 15px; color: #6b7280; text-align:center; padding: 12px; }
247
-
248
  /* Responsive */
249
  @media (max-width: 700px) {
250
  .card-header { flex-direction: column; align-items: flex-start; }
 
29
  with open("data/unique_anchor_texts.pkl", "rb") as f:
30
  unique_anchor_texts = pickle.load(f)
31
 
32
+ model = SentenceTransformer("omarelshehy/arabic-english-sts-matryoshka-v2.0")
33
  model.max_seq_length = 512
34
 
35
  # Quick dimension check
 
177
  custom_css = """
178
  /* Page */
179
  body { background-color: #f5f7fb; font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif; }
 
180
  /* Container (results) keeps RTL for hadith text blocks but LTR for metadata */
181
  .results { margin-top: 10px; }
 
182
  /* Card */
183
  .card {
184
  background: #ffffff;
 
188
  box-shadow: 0 6px 20px rgba(18, 38, 63, 0.06);
189
  border: 1px solid rgba(20, 43, 74, 0.03);
190
  }
 
191
  /* Header layout */
192
  .card-header {
193
  display: flex;
 
196
  gap: 12px;
197
  margin-bottom: 10px;
198
  }
 
199
  .card-header .left { display:flex; flex-direction: column; gap:6px; }
200
  .index {
201
  display:inline-block;
 
207
  font-size: 13px;
208
  width: fit-content;
209
  }
 
210
  .title {
211
  font-size: 18px;
212
  font-weight: 700;
213
  color: #0f172a;
214
  }
 
215
  .topic {
216
  font-size: 13px;
217
  color: #475569;
218
  margin-top: 4px;
219
  }
 
220
  /* Right meta */
221
  .right-meta { text-align: right; min-width: 120px; }
222
  .meta { font-size: 12px; color: #6b7280; }
223
  .meta-val { color: #0f172a; font-weight: 600; margin-left: 6px; }
 
224
  /* Hadith text: keep RTL and readable */
225
  .text-rtl { direction: rtl; margin-top: 6px; margin-bottom: 10px; }
226
  .text-rtl .summary { cursor: pointer; font-size: 16px; color: #111827; line-height: 1.9; }
227
  .text-rtl .full-text { margin-top: 8px; font-size: 16px; color: #111827; line-height: 1.9; }
 
228
  /* Footer link */
229
  .footer { margin-top: 12px; }
230
  .footer a {
 
232
  color: #2563eb; font-weight: 600;
233
  }
234
  .footer a:hover { text-decoration: underline; }
 
235
  /* Empty state */
236
  .empty { font-size: 15px; color: #6b7280; text-align:center; padding: 12px; }
 
237
  /* Responsive */
238
  @media (max-width: 700px) {
239
  .card-header { flex-direction: column; align-items: flex-start; }