Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -140,35 +140,26 @@ def results_to_html(df):
|
|
| 140 |
if df.empty:
|
| 141 |
return "<p>❌ لا توجد نتائج</p>"
|
| 142 |
|
| 143 |
-
# استبعاد أعمدة
|
| 144 |
df = df.drop(columns=["embedding", "score"], errors="ignore")
|
| 145 |
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
html += (
|
| 159 |
-
f"<caption style='caption-side:top;text-align:right;"
|
| 160 |
-
f"font-weight:bold;margin-bottom:5px;'>"
|
| 161 |
-
f"📘 النتيجة {i+1}</caption>"
|
| 162 |
-
)
|
| 163 |
-
|
| 164 |
-
for col, val in row.items():
|
| 165 |
-
html += f"<tr><th>{col}</th><td>{val}</td></tr>"
|
| 166 |
-
|
| 167 |
-
html += "</table>"
|
| 168 |
-
|
| 169 |
html += "</div>"
|
|
|
|
| 170 |
return html
|
| 171 |
|
|
|
|
| 172 |
# ================== البحث ==================
|
| 173 |
def local_search_df(query, mode, source_filter, year_range):
|
| 174 |
if not query.strip():
|
|
|
|
| 140 |
if df.empty:
|
| 141 |
return "<p>❌ لا توجد نتائج</p>"
|
| 142 |
|
| 143 |
+
# استبعاد أعمدة غير مطلوبة
|
| 144 |
df = df.drop(columns=["embedding", "score"], errors="ignore")
|
| 145 |
|
| 146 |
+
# اختيار الأعمدة الأساسية فقط
|
| 147 |
+
cols = ["العنوان", "المؤلف", "سنة النشر", "الموقع على الرف"]
|
| 148 |
+
cols = [c for c in cols if c in df.columns] # في حالة أي عمود ناقص
|
| 149 |
+
|
| 150 |
+
html = CUSTOM_CSS
|
| 151 |
+
html += "<div style='direction:rtl;text-align:right;'>"
|
| 152 |
+
html += df[cols].to_html(
|
| 153 |
+
index=False,
|
| 154 |
+
escape=False,
|
| 155 |
+
classes="styled-table",
|
| 156 |
+
border=0
|
| 157 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
html += "</div>"
|
| 159 |
+
|
| 160 |
return html
|
| 161 |
|
| 162 |
+
|
| 163 |
# ================== البحث ==================
|
| 164 |
def local_search_df(query, mode, source_filter, year_range):
|
| 165 |
if not query.strip():
|