Welcome to the AI-WEB-GuessingGame repository! This project is an interactive web-based guessing game centered on identifying animals. It is developed using Python and Streamlit as part of a university course.
The project follows a straightforward architecture:
-
Backend and Frontend:
- The web application is created using Streamlit, which handles both the frontend and backend seamlessly.
- Data with animal information was fetched from the Animals API.
- Key components:
game.py
: Contains the main game logic.stats.py
: Responsible for visualizing game statistics.utils.py
: Includes utility functions, such as calculating user scores.betterAnimalDB/animals.json
: DB for animal data.
-
Game Logic:
- Users guess animals based on clues provided after each guess. Each clue highlights 1-4 shared characteristics between the guessed and the target animal.
- The fewer guesses the user takes to identify the animal, the higher their score.
- The quality of each guess is measured by the number of shared characteristics, with the result visually indicated by clue colors.
- During the final guess, users can interact with (Open) AI for a hint via a chat feature.
-
Deployment:
- The app can be run locally or accessed via Streamlit Cloud (link provided in the repository description).
- Important: The statistics feature is currently fully functional only when the application is started locally.
To run the project locally, make sure you have the following installed:
-
Python
- Download from python.org.
-
Streamlit
- Install Streamlit via pip:
pip install streamlit
- Install Streamlit via pip:
-
Set Up OpenAI API Key
- Create a folder named
.streamlit
in your project's root directory. - Inside the
.streamlit
folder, create a file calledsecrets.toml
. - Add your OpenAI API key to the
secrets.toml
file in the following format:OPEN-AI-KEY = "your-api-key-here"
- Replace
your-api-key-here
with your actual OpenAI API key.
- Create a folder named
-
Other Dependencies:
- Additional libraries are listed in the
requirements.txt
file. - Install them using:
pip install -r requirements.txt
- Additional libraries are listed in the
streamlit run app.py