File size: 389 Bytes
a7ac876
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from fastapi import FastAPI
from utils import fetch_news_data

app = FastAPI()

@app.get("/")
def home():
    return {"message": "News Summarization API is running!"}

@app.get("/news/")
def get_news(company_name: str, article_number: int):
    results = fetch_news_data(company_name, article_number)
    return {"news": results}

# run locally with: uvicorn api:app --reload