Spaces:
Sleeping
title: Mesop Jeopardy
emoji: 🤓
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
Mesop Jeopardy
Simple jeopardy game built using Mesop. User answers are checked using the Gemini API.
In order to run the app, you will need a Google API Key for Gemini Pro. You can create one using the instructions at https://ai.google.dev/gemini-api/docs/api-key.
git clone [email protected]:richard-to/mesop-jeopardy.git
cd mesop-jeopardy
pip install -r requirements.txt
GOOGLE_API_KEY=<your-api-key> mesop main.py
You can try out a demo here on Hugging Face Spaces.
Notes on the Jeopardy questions dataset
One thing to note is I haven't included the jeopardy.json file. I'm using an old dataset of 200K questions that's about 10 years old now. You can find it with a quick Google search.
The file needs to be added to the data folder and named jeopardy.json. The format is like this
{
"category": "HISTORY",
"air_date": "2004-12-31",
"question": "'For the last 8 years of his life, Galileo was...",
"value": "$200",
"answer": "Copernicus",
"round": "Jeopardy!",
"show_number": "4680"
}
If you do not want to use the existing Jeopardy data set, you can set the environment
variable GENERATE_JEOPARDY_QUESTIONS=True
to generate the questions from Gemini.
Deployment
This repository also contains configuration to deploy to GCP App Engine, GCP Cloud Run, or using Docker.
The instructions below assume you have a jeopardy.json
file in the data folder and
that you have a Google API Key to make Gemini API calls.
Docker
This section shows how to run Mesop Jeopardy from a Docker image.
Step 0 - Install Docker
Make sure Docker and Docker Compose are installed.
Step 2 - Add Google API key
In the docker-compose.yml
set the Google API Key.
environment:
- GOOGLE_API_KEY=YOUR-API-KEY-HERE
Step 3 - Run Docker image
Run this command in the repository working directory:
docker-compose up -d
Step 4 - View the app
The app should now be viewable at localhost:8080.
App Engine
This section describes how to deploy Mesop Jeopardy with App Engine Flexible.
Step 0 - GCP setup
This section assumes that you have a properly configured Google Cloud Platform (GCP) account (e.g. GCP project to use, Billing enabled, Google Cloud CLI installed).
See the instructions here: https://cloud.google.com/appengine/docs/flexible/python/create-app#before-you-begin
Step 1 - Enable App Engine
gcloud app create --project=[YOUR_PROJECT_ID]
gcloud components install app-engine-python
Step 2 - Add Google API key
Set your Google API key in app.yaml
.
env_variables:
GOOGLE_API_KEY: YOUR-API-KEY
Step 3 - Deploy
Run this command in the repository working directory.
gcloud app deploy
Step 4 - View the app
gcloud app browse
Cloud Run
This section describes how to deploy Mesop Jeopardy with Cloud Run.
Step 0 - GCP setup
This section assumes that you have a properly configured Google Cloud Platform (GCP) account (e.g. GCP project to use, Billing enabled, Google Cloud CLI installed).
See the instructions here: https://cloud.google.com/run/docs/quickstarts/build-and-deploy/deploy-python-service#before-you-begin
Step 1 - Deploy
Run this command in the repository working directory.
gcloud run deploy mesop-jeopardy \
--source . \
--set-env-vars GOOGLE_API_KEY=API_KEY \
--region us-east4
Step 2 - View app
When the deploy command is done, you should see a URL to the Cloud Run app.
Screenshots
Here are some screenshots of the UI.