try-deploy-qwen / app.py
affandes's picture
Update app.py
39c5525 verified
raw
history blame contribute delete
344 Bytes
from fastapi import FastAPI
from pydantic import BaseModel
from chat_qwen import get_response
app = FastAPI()
# Request model
class Prompt(BaseModel):
text: str
# Route to sum two numbers
@app.post("/chat")
async def calculate_sum(prompt: Prompt):
result = get_response(prompt.text)
return {"ask": prompt.text, "answer": result}