File size: 1,111 Bytes
06dd463
19f5626
 
 
 
 
 
 
06dd463
0f85829
 
 
 
5e51956
 
 
 
0f85829
 
 
 
5e51956
0f85829
5e51956
 
 
0f85829
 
5e51956
0f85829
5e51956
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
title: INSPIRE HEP Search
emoji: ⚛️
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: "5.8.0"
app_file: app.py
pinned: false
---

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:

## Search Enhancement:

1. Takes a user query and uses GPT-4 to expand it into multiple relevant search variations
2. Searches the INSPIRE HEP database using these expanded queries

Example: "how far are black holes?" gets expanded into multiple variations like "distance from black holes", "remoteness of black holes", etc.


## Result Processing:

1. Retrieves academic papers from INSPIRE HEP
2. Formats the paper metadata including authors, year, title, and DOI
3. Creates a context from the papers' titles and abstracts


## AI Answer Generation:

1. Uses GPT-4 to generate a comprehensive answer based on the search results
2. Citations are included in the format [1], [2], etc.
3. Cleans up and renumbers the references to match only the cited papers
4. Provides a summary at the end of each answer