Hugging Face
Models
Datasets
Spaces
Posts
Docs
Enterprise
Pricing
Log In
Sign Up
Spaces:
momegas
/
megabots
like
1
Runtime error
App
Files
Files
Fetching metadata from the HF Docker repository...
df40774
megabots
/
qnabot
/
api.py
momegas
π Add a gradio UI
df40774
almost 2 years ago
raw
Copy download link
history
blame
260 Bytes
from
fastapi
import
FastAPI
from
qnabot
import
QnABot
def
create_app
(
bot: QnABot
):
app = FastAPI()
@app.get(
"/v1/ask/{question}"
)
async
def
ask
(
question:
str
):
answer = bot.ask(question)
return
{
"answer"
: answer}
return
app