Spaces:
Runtime error
Runtime error
Commit
·
f599270
1
Parent(s):
2ba4f9b
Update app.py
Browse files
app.py
CHANGED
@@ -45,7 +45,7 @@ def generate_response(prompt):
|
|
45 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
46 |
return response
|
47 |
|
48 |
-
def
|
49 |
Entrez.email = '[email protected]' # Always set the Entrez.email to tell NCBI who you are
|
50 |
search_kwargs = {
|
51 |
"db": "pubmed",
|
@@ -88,9 +88,24 @@ def search_pubmed(query, retmax=5, mindate=None, maxdate=None, datetype="pdat"):
|
|
88 |
return pd.DataFrame(abstracts)
|
89 |
|
90 |
# Function to search PubMed for articles
|
91 |
-
def
|
92 |
Entrez.email = '[email protected]'
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
record = Entrez.read(handle)
|
95 |
handle.close()
|
96 |
idlist = record['IdList']
|
|
|
45 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
46 |
return response
|
47 |
|
48 |
+
def search_pubmed_v2(query, retmax=5, mindate=None, maxdate=None, datetype="pdat"):
|
49 |
Entrez.email = '[email protected]' # Always set the Entrez.email to tell NCBI who you are
|
50 |
search_kwargs = {
|
51 |
"db": "pubmed",
|
|
|
88 |
return pd.DataFrame(abstracts)
|
89 |
|
90 |
# Function to search PubMed for articles
|
91 |
+
def search_pubmed(query, retmax=5, mindate=None, maxdate=None, datetype="pdat"):
|
92 |
Entrez.email = '[email protected]'
|
93 |
+
|
94 |
+
search_kwargs = {
|
95 |
+
"db": "pubmed",
|
96 |
+
"term": query,
|
97 |
+
"retmax": retmax,
|
98 |
+
"sort": 'relevance',
|
99 |
+
"datetype": datetype
|
100 |
+
}
|
101 |
+
|
102 |
+
# If dates are provided, add them to the search arguments
|
103 |
+
if mindate:
|
104 |
+
search_kwargs["mindate"] = mindate
|
105 |
+
if maxdate:
|
106 |
+
search_kwargs["maxdate"] = maxdate
|
107 |
+
|
108 |
+
handle = Entrez.esearch(search_kwargs)
|
109 |
record = Entrez.read(handle)
|
110 |
handle.close()
|
111 |
idlist = record['IdList']
|