Spaces:
Sleeping
Sleeping
updated
Browse files
README.md
CHANGED
|
@@ -7,4 +7,27 @@ sdk: gradio
|
|
| 7 |
sdk_version: "5.8.0"
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
sdk_version: "5.8.0"
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
This code creates a web interface using Gradio that combines INSPIRE HEP (High Energy Physics) database searches with AI-powered responses. Here's what it does:
|
| 13 |
+
|
| 14 |
+
Search Enhancement:
|
| 15 |
+
|
| 16 |
+
Takes a user query and uses GPT-4 to expand it into multiple relevant search variations
|
| 17 |
+
Searches the INSPIRE HEP database using these expanded queries
|
| 18 |
+
Example: "how far are black holes?" gets expanded into multiple variations like "distance from black holes", "remoteness of black holes", etc.
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
Result Processing:
|
| 22 |
+
|
| 23 |
+
Retrieves academic papers from INSPIRE HEP
|
| 24 |
+
Formats the paper metadata including authors, year, title, and DOI
|
| 25 |
+
Creates a context from the papers' titles and abstracts
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
AI Answer Generation:
|
| 29 |
+
|
| 30 |
+
Uses GPT-4 to generate a comprehensive answer based on the search results
|
| 31 |
+
Citations are included in the format [1], [2], etc.
|
| 32 |
+
Cleans up and renumbers the references to match only the cited papers
|
| 33 |
+
Provides a summary at the end of each answer
|
app.py
CHANGED
|
@@ -213,6 +213,9 @@ client = OpenAI()
|
|
| 213 |
|
| 214 |
with gr.Blocks() as demo:
|
| 215 |
gr.Markdown("# Feynbot on INSPIRE HEP Search")
|
|
|
|
|
|
|
|
|
|
| 216 |
with gr.Row():
|
| 217 |
with gr.Column():
|
| 218 |
query = gr.Textbox(label="Search Query")
|
|
|
|
| 213 |
|
| 214 |
with gr.Blocks() as demo:
|
| 215 |
gr.Markdown("# Feynbot on INSPIRE HEP Search")
|
| 216 |
+
gr.Markdown("""Specialized academic search tool that combines traditional
|
| 217 |
+
database searching with AI-powered query expansion and result
|
| 218 |
+
synthesis, focused on physics research papers.""")
|
| 219 |
with gr.Row():
|
| 220 |
with gr.Column():
|
| 221 |
query = gr.Textbox(label="Search Query")
|