Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,9 +9,8 @@ from Gradio_UI import GradioUI
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
-
def my_custom_tool(str1:str, api_key:str)-> str:
|
| 13 |
-
|
| 14 |
-
"""
|
| 15 |
A tool that performs a search in the PubMed database using the NCBI E-utilities API.
|
| 16 |
|
| 17 |
This tool sends a request to the PubMed database with a specified search term and returns
|
|
@@ -34,11 +33,11 @@ def my_custom_tool(str1:str, api_key:str)-> str: #it's import to specify the ret
|
|
| 34 |
params = {
|
| 35 |
"db": "pubmed",
|
| 36 |
"term": str1,
|
| 37 |
-
"retmax": 5, #
|
| 38 |
-
"api_key": api_key #
|
| 39 |
}
|
| 40 |
|
| 41 |
-
#
|
| 42 |
response = requests.get(base_url, params=params)
|
| 43 |
return response.text
|
| 44 |
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def my_custom_tool(str1: str, api_key: str) -> str:
|
| 13 |
+
"""
|
|
|
|
| 14 |
A tool that performs a search in the PubMed database using the NCBI E-utilities API.
|
| 15 |
|
| 16 |
This tool sends a request to the PubMed database with a specified search term and returns
|
|
|
|
| 33 |
params = {
|
| 34 |
"db": "pubmed",
|
| 35 |
"term": str1,
|
| 36 |
+
"retmax": 5, # Limit the number of results
|
| 37 |
+
"api_key": api_key # API key for authentication
|
| 38 |
}
|
| 39 |
|
| 40 |
+
# Send the request
|
| 41 |
response = requests.get(base_url, params=params)
|
| 42 |
return response.text
|
| 43 |
|