Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,8 +21,10 @@ def news_aggregator(keyword: str, max_results: int = 5) -> str:
|
|
| 21 |
A string containing the titles and URLs of the latest news articles.
|
| 22 |
"""
|
| 23 |
try:
|
| 24 |
-
|
| 25 |
-
api_key = "
|
|
|
|
|
|
|
| 26 |
url = f"https://newsapi.org/v2/everything?q={keyword}&pageSize={max_results}&apiKey={api_key}"
|
| 27 |
|
| 28 |
# Make the API request
|
|
@@ -58,7 +60,8 @@ final_answer = FinalAnswerTool()
|
|
| 58 |
model = HfApiModel(
|
| 59 |
max_tokens=2096,
|
| 60 |
temperature=0.5,
|
| 61 |
-
model_id='
|
|
|
|
| 62 |
custom_role_conversions=None,
|
| 63 |
)
|
| 64 |
|
|
|
|
| 21 |
A string containing the titles and URLs of the latest news articles.
|
| 22 |
"""
|
| 23 |
try:
|
| 24 |
+
|
| 25 |
+
api_key = os.getenv("NEWSAPI_KEY") # Fetch the API key from environment variables
|
| 26 |
+
if not api_key:
|
| 27 |
+
return "NewsAPI key is missing. Please set the NEWSAPI_KEY environment variable."
|
| 28 |
url = f"https://newsapi.org/v2/everything?q={keyword}&pageSize={max_results}&apiKey={api_key}"
|
| 29 |
|
| 30 |
# Make the API request
|
|
|
|
| 60 |
model = HfApiModel(
|
| 61 |
max_tokens=2096,
|
| 62 |
temperature=0.5,
|
| 63 |
+
model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 64 |
+
# model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 65 |
custom_role_conversions=None,
|
| 66 |
)
|
| 67 |
|