File size: 484 Bytes
b396e94 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
from fastapi import FastAPI
from pydantic import BaseModel
from main import analyze_company_news # Import the function from main.py
app = FastAPI()
class CompanyRequest(BaseModel):
Company_Name: str
@app.post("/api/company")
async def handle_company(request: CompanyRequest):
company = request.Company_Name.strip()
result = analyze_company_news(company)
return result
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="127.0.0.1", port=8000) |