Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,14 +21,22 @@ text_embeddings = model.encode(df["combined_text"].tolist(), convert_to_tensor=F
|
|
| 21 |
results_dict = {}
|
| 22 |
|
| 23 |
# Create markdown from results
|
|
|
|
| 24 |
def format_markdown(top_results):
|
| 25 |
markdown_output = ""
|
| 26 |
for _, row in top_results.iterrows():
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
return markdown_output
|
| 31 |
|
|
|
|
|
|
|
| 32 |
# Auto-query construction and retrieval
|
| 33 |
def process_query_csv(query_file):
|
| 34 |
global results_dict
|
|
|
|
| 21 |
results_dict = {}
|
| 22 |
|
| 23 |
# Create markdown from results
|
| 24 |
+
|
| 25 |
def format_markdown(top_results):
|
| 26 |
markdown_output = ""
|
| 27 |
for _, row in top_results.iterrows():
|
| 28 |
+
title = row['Title']
|
| 29 |
+
link = row['Link']
|
| 30 |
+
desc = row['Description']
|
| 31 |
+
date_str = row['Date'].strftime('%Y-%m-%d') if pd.notnull(row['Date']) else 'N/A'
|
| 32 |
+
|
| 33 |
+
markdown_output += f"### [{title}]({link})\n"
|
| 34 |
+
markdown_output += f"**Date**: {date_str}\n\n"
|
| 35 |
+
markdown_output += f"{desc}\n\n---\n"
|
| 36 |
return markdown_output
|
| 37 |
|
| 38 |
+
|
| 39 |
+
|
| 40 |
# Auto-query construction and retrieval
|
| 41 |
def process_query_csv(query_file):
|
| 42 |
global results_dict
|