TinyLLamaTesting / backend.py
Pudding48's picture
Update backend.py
1beff3e verified
raw
history blame
327 Bytes
# backend.py (in root of Space repo)
from fastapi import FastAPI
from pydantic import BaseModel
from qabot import llm_chain
app = FastAPI()
class Query(BaseModel):
query: str
@app.post("/ask")
def ask_question(query: Query):
result = llm_chain.invoke({"query": query.query})
return {"answer": result["result"]}