File size: 1,185 Bytes
0901162 a0e09ac 0901162 73acaaa 0901162 3156c38 0901162 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
from fastapi import FastAPI,status,HTTPException
# from .models import lr
import schemas
import Database
import models
import Cleaning
app=FastAPI()
@app.get('/')
def index():
return "This is the defult page"
@app.get('/reviews',status_code=status.HTTP_200_OK)
def get_reviews():
return "Reviews"
#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")
#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
|