from fastapi import FastAPI,status,HTTPException # from .models import lr import schemas import Database import models import Cleaning import pytz from datetime import datetime app=FastAPI() @app.get('/') def index(): tz = pytz.timezone('Etc/GMT+3') return "This is the defult page"+str(datetime.now(tz)) @app.get('/reviews',status_code=status.HTTP_200_OK) def get_reviews(): return "Reviews"+str(datetime.today().date()) #Porcessing Shakwa @app.post('/predict_summary') async def get_reviews(request : schemas.shakwa): if 'text' in request: return models.modelsummary(request.complaintbody) else: raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="Missing text value") #Porcessing Feedback @app.post('/predict_sentiment') def get_reviews(request : schemas.feedback): if 'text' in request: return models.modelpredict(request.text) else: raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="Missing mathod value") @app.get("/emotionCount") def getemotionCount(): return Database.emotioncount #Analysis @app.get('/CommonWords') def get_reviews(): data=Database.shakwa_common_words() return data @app.get('/CommonPlaces') def get_reviews(): # data={"Most Common Words":{"مدينة نصر":11,"الدقي":12}} data=Database.get_most_common_places() return data