from fastapi import FastAPI from pydantic import BaseModel, validator from utils import summary import os from huggingface_hub import login os.environ['HF_HOME'] = '/hug/cache/' os.environ['TRANSFORMERS_CACHE'] = '/blabla/cache/' class Item(BaseModel): FileURL: str = "https://www.bseindia.com/stockinfo/AnnPdfOpen.aspx?Pname=d141ef4f-7856-4236-8f6f-efe09592df40.pdf" memo: str = "Please find attached RTA Certificate u/r 74(5) of SEBI (DP) Regulations 2018 for QE March 2024" TypeofAnnouncement: str = "General_Announcements" Descriptor: str = "Certificate under Reg. 74 (5) of SEBI (DP) Regulations 2018" caption: str = "Compliances-Certificate under Reg. 74 (5) of SEBI (DP) Regulations 2018" newsdate: str = "2024-04-08T13:05:27" symbol: str = "EDELWEISS" app = FastAPI() @app.get("/") async def root(): return {"Summarize":"Version 1.5 'Images Added'"} @app.post("/Summarize/") def read_user(input_json: Item): return summary(input_json.dict())