Created
March 23, 2022 21:44
-
-
Save jcabot/b0d5b3963c395251d998dff364398efb to your computer and use it in GitHub Desktop.
Wrapping of the intent classifier in a REST Api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.post("/bot/{name}/train/") | |
def bot_train(name: str, configurationdto: ConfigurationDTO): | |
if name not in bots.keys(): | |
raise HTTPException(status_code=422, detail="Bot does not exist") | |
bot: Bot = bots[name] | |
if len(bot.contexts) == 0: | |
raise HTTPException(status_code=422, detail="Bot is empty, nothing to train") | |
bot.configuration = configurationdto_to_configuration(configurationdto) | |
train(bot) | |
return {"status:" : "successful training for " + str(len(bot.contexts)) + " contexts"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment