|
from fastapi import FastAPI,status,HTTPException |
|
|
|
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" |
|
|
|
|
|
@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") |
|
|
|
|
|
@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('/CommonWords') |
|
def get_reviews(): |
|
data=Database.shakwa_common_words() |
|
return data |
|
|
|
@app.get('/CommonPlaces') |
|
def get_reviews(): |
|
|
|
data=Database.get_most_common_places() |
|
return data |
|
|
|
|