File size: 344 Bytes
200755e
 
 
6c6c37a
200755e
6c6c37a
200755e
 
 
6c6c37a
200755e
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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}