π Winner β Most Creative Hack at PennApps XXVI
CharAIdes is a real-time, AI-powered charades experience where a player acts out a word on webcam and an AI (via this backend) tries to guess it. Built for PennApps XXVI, the backend focuses on fast image handling, robust AI integration, and reliable scoring/leaderboard APIs.
- Receives live webcam frames and a target word, then invokes Gemini Vision to guess the action
- Returns a structured result indicating the modelβs guess and whether it matches the target
- Persists per-player scores and exposes a sorted leaderboard
- Performs lightweight image preprocessing (resize/convert to JPEG) for consistent AI input
- FastAPI endpoints:
- POST
/guessβ multipart upload (frame) + target word β AI guess + match result - POST
/leaderboardβ submit score (username + score) - GET
/leaderboardβ fetch top scores (sorted desc, limited)
- POST
- Local SQLite leaderboard with init/reset + seed helpers
- Image normalization via Pillow (thumbnail β JPEG)
- Simple word-list matching and prompt shaping for reliable classification
- Backend: FastAPI (Python), Uvicorn (ASGI)
- Storage: SQLite (via Pythonβs sqlite3)
- Imaging: Pillow
- AI: Gemini 2.0 Flash Lite
- Uploads: python-multipart
- Optional: python-dotenv for local env loading
- Expand the word list with nuanced gestures and actions
- Add multiplayer modes and persistent accounts
- Experiment with multimodal prompts (audio + visual) to enrich AI judgments
- Clone the repository
git clone https://github.com/PennApps2025/BackAiCharades.git
cd BackAiCharades- Create and activate a virtual environment
Windows (PowerShell):
python -m venv venv
venv\Scripts\Activate.ps1macOS / Linux:
python3 -m venv venv
source venv/bin/activate- Install dependencies
pip install -r requirements.txt- Create a
.envfile and add your Gemini API key
GEMINI_API_KEY=your_gemini_api_key_here- Initialize or reset the local leaderboard DB (seeds sample data)
python .\app\init_db.pyThis drops/recreates the leaderboard table and inserts sample rows.
- Run the server
uvicorn app.main:app --reloadOpen http://localhost:8000/docs for interactive API docs.