File size: 433 Bytes
0ea0063
 
 
 
 
35740c0
0ea0063
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from fastapi import FastAPI
from pydantic import BaseModel
from transformers import pipeline

app = FastAPI()
chatbot = pipeline("conversational", model="CaptMetal/BuddAi")

class Message(BaseModel):
    text: str

@app.post("/chat")
async def chat(message: Message):
    response = chatbot(message.text)
    return {"response": response}

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=8000)