Spaces:
Running
Running
Updated search function
Browse filesMade the response more readable
app.py
CHANGED
@@ -87,13 +87,14 @@ def search_papers(user_input):
|
|
87 |
print(f"DEBUG: Results received - {results}") # Debug function output
|
88 |
|
89 |
if isinstance(results, list) and results and isinstance(results[0], dict):
|
90 |
-
# ✅ Format output
|
91 |
formatted_results = "\n\n".join([
|
92 |
-
f"
|
93 |
-
f"**
|
94 |
-
f"**
|
95 |
-
f"**
|
96 |
-
f"
|
|
|
97 |
for paper in results
|
98 |
])
|
99 |
return formatted_results
|
@@ -102,6 +103,7 @@ def search_papers(user_input):
|
|
102 |
return "No results found. Try different keywords."
|
103 |
|
104 |
|
|
|
105 |
# Create Gradio UI
|
106 |
with gr.Blocks() as demo:
|
107 |
gr.Markdown("# ScholarAgent")
|
|
|
87 |
print(f"DEBUG: Results received - {results}") # Debug function output
|
88 |
|
89 |
if isinstance(results, list) and results and isinstance(results[0], dict):
|
90 |
+
# ✅ Format output with spacing and line breaks
|
91 |
formatted_results = "\n\n".join([
|
92 |
+
f"---\n\n"
|
93 |
+
f"📌 **Title:**\n{paper['title']}\n\n"
|
94 |
+
f"👨🔬 **Authors:**\n{paper['authors']}\n\n"
|
95 |
+
f"📅 **Year:** {paper['year']}\n\n"
|
96 |
+
f"📖 **Abstract:**\n{paper['abstract'][:500]}... *(truncated for readability)*\n\n"
|
97 |
+
f"[🔗 Read Full Paper]({paper['link']})\n\n"
|
98 |
for paper in results
|
99 |
])
|
100 |
return formatted_results
|
|
|
103 |
return "No results found. Try different keywords."
|
104 |
|
105 |
|
106 |
+
|
107 |
# Create Gradio UI
|
108 |
with gr.Blocks() as demo:
|
109 |
gr.Markdown("# ScholarAgent")
|