fastapi / main_util.py
steveagi's picture
copy from ai2
7e320e6
raw
history blame
363 Bytes
from fastapi import HTTPException, status
import snake
import angrybird
GAME_ANGRY_BIRD = 'angrybird'
GAME_SNAKE = 'snake'
def nlp(game: str, command: str):
if game == GAME_ANGRY_BIRD:
return angrybird.process(command)
if game == GAME_SNAKE:
return snake.process(command)
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND)