Spaces:
Sleeping
Sleeping
Update app.py
Browse files20 unmodified lines212223242526272829 unmodified lines5859606162636420 unmodified linesA string containing the titles and URLs of the latest news articles."""try:# I am using the NewsAPI keyapi_key = "d43565ac0e674145a22c5f0de4dcd69c"url = f"https://newsapi.org/v2/everything?q={keyword}&pageSize={max_results}&apiKey={api_key}"# Make the API request29 unmodified linesmodel = HfApiModel(max_tokens=2096,temperature=0.5,model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloadedcustom_role_conversions=None,)20 unmodified lines2122232425262728293029 unmodified lines606162636465666720 unmodified linesA string containing the titles and URLs of the latest news articles."""try:api_key = os.getenv("NEWSAPI_KEY") # Fetch the API key from environment variablesif not api_key:return "NewsAPI key is missing. Please set the NEWSAPI_KEY environment variable."url = f"https://newsapi.org/v2/everything?q={keyword}&pageSize={max_results}&apiKey={api_key}"# Make the API request29 unmodified linesmodel = HfApiModel(max_tokens=2096,temperature=0.5,model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'# model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloadedcustom_role_conversions=None,)
app.py+6-3