Sample-API / app.py
adhvaithprasad
tweaked the code for the error in HF
4baab8b
raw
history blame
762 Bytes
from fastapi import FastAPI
from pydantic import BaseModel
from calculator import calculate
from sentimentAnalysis import sentimentAnalysis
from customerSupport import customerConverstaion
class User_input(BaseModel):
sentence:str
operation:str
x:float
y:float
app = FastAPI()
@app.get("/hello")
def greet_json():
return {"Hello": "World!"}
@app.post("/calculate")
def calculate_func(input:User_input):
res= calculate(input.operation, input.x, input.y)
return res
@app.post("/sentimentAnalysis")
def sentimentAnalysis_func(input:User_input):
res= sentimentAnalysis(input.sentence)
return res
@app.post("/getReply")
def getReply_func(input:User_input):
res= customerConverstaion(input.sentence)
return res