Playing 20q against an LLM

This is a quick project where i hae created a 20 questions game using an LLM and Gradio.

The game is 20 questions - whereby you, the user, think of something (i.e. a dog, a coffee, a display, a football) and the AI has to guess what you are thinking of. The AI can ask up to 20 yes/no questions to find out what you are thinking of. You must answer yes or no truthfully.

Note:

  • The AI should only play 20 questions, and should respond with an apologetic response when asked about something unrelated.
  • You are not required to train or fine tune an LLM.

Local deployment

  1. Install dependencies
pip install -r requirements.txt
  1. Run the application
python app.py

Deploying to AWS Lambda

  1. install the AWS CDK CLI
npm install -g aws-cdk
  1. Install dependencies
pip install -r cdk_requirements.txt
  1. Bootstrap the CDK

[optional]: export aws profile

export AWS_PROFILE=hf-sm

Boostrap project in the cloud

cdk bootstrap
  1. Deploy Gradio application to AWS Lambda
cdk deploy 
  1. Delete AWS Lambda again
cdk destroy