qa-api / server.py
SebastianSchramm's picture
add first version
2dcc710
raw
history blame
573 Bytes
import logging
from fastapi import FastAPI
from pydantic import BaseModel
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class InputLoad(BaseModel):
question: str
class ResponseLoad(BaseModel):
answer: str
app = FastAPI()
@app.get("/health")
def health_check():
return {"server": "running"}
@app.post("/answer")
async def receive(input_load: InputLoad) -> ResponseLoad:
return ResponseLoad(answer="Hi, happy to help you with that. According to my information this is possible! Hope that was helpful!")