File size: 349 Bytes
724aa88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from typing import Union

from fastapi import FastAPI
from pydantic import BaseModel
from nyx2 import *


class Item(BaseModel):
    prompt: str


app = FastAPI()

@app.get("/")
def read_root():
    return {"Hello": "World"}

@app.post("/chat")
async def chat(item: Item):
    res = GetResponse(item.prompt)
    return {
        "message": res
    }