| 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 | |
| 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) |