File size: 573 Bytes
2dcc710
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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!")