- PostgresSQL or SQLite
- Redis
See https://docs.pipenv.org/#install-pipenv-today
You can create an API key on your clarifai dashboard.
The API key must have the following scopes:
- Models:Get
- Predict
Once created add this key to your .env
file:
echo "CLARIFAI_API_KEY=<YOUR_CLARIFAI_API_KEY>" >> .env
pipenv install
pipenv run python manage.py migrate
pipenv run python manage.py runserver localhost:5000
Now the site is runnning and auto-reloading the sources
pipenv install [DEPENDENCY]
pipenv run pip freeze > requirements.txt
GET /api/running-challenges/ Get the running challenges (normally, only one)
GET /api/scores/ Get the scores
GET /api/challenges/ Get all the registered challenges
Response:
{
"challenges": [
{
"riddle_text": "Best human friend",
"id": 1
},
{
"riddle_text": "Composed by one oxygen atom and two hydrogen atom",
"id": 2
}
]
}
GET /api/challenges/:challenge_id Get the riddle for a specific challenge
Response:
{
"challenge": {
"riddle_text": "Best human friend",
"id": 1
}
}
POST /api/challenges/:challenge_id/solve Check if an attempt to solve the current challenge is valid.
Parameters:
player_pseudo
OPTIONAL: pseudo of the trying player
Response:
If the challenge is solved:
{
"solved": true,
"text": "GGWP"
}
If the challenge is not solved:
{
"solved": false,
"text": "Nice try!",
"guessed": {
"concepts": [
{
"id": "ai_mFqxrph2",
"name": "cat",
"value": 0.9651122,
"app_id": "main"
},
{
"id": "ai_SzsXMB1w",
"name": "animal",
"value": 0.95982313,
"app_id": "main"
},
{
"id": "ai_TJ9wFfK5",
"name": "portrait",
"value": 0.9448299,
"app_id": "main"
}
]
}
}
pipenv run python manage.py run_bot