Ever wondered what role you would play if you were a cosmic voyager, adventuring through space with your resourceful crew members?
Spacefarer uses machine learning to determine what type of astronaut you would be, based on your responses to a series of questions about your personality.
You can be one of the following types of astronauts:
- Navigator - steers and guides the spacecraft in the vast depths of space.
- Communicator - maintains contact with stations and other spacecrafts.
- Explorer - ventures boldly into uncharted realms and territories.
- Commander - leading the spacecraft, its crew and their operation.
- Scientist - conducting research and unraveling the mysteries of the cosmos.
Spacefarer asks you a series of 20 space-themed questions; 4 questions each for the 5 personality traits of the Big Five Personality Test:
- Openness
- Neuroticism
- Conscientiousness
- Agreeableness
- Extraversion
The answers provided to these questions are passed to a trained and deserialized model, which predicts your personality type, which is in turn mapped to a type of astronaut.
Spacefarer is built as a Flask web app, styled with TailwindCSS and powered by a LogisticRegression
model trained on a small (approx. 700 samples) dataset from Kaggle. The model has an accuracy of 81.53%.
Spacefarer has very few prerequisites, which are probably already installed on your system:
- Git version control system
- Python (recommended to have a version greater than 3.9.0)
- Node.js (recommended to have a version greater than 18.0.0)
To run Spacefarer locally on your machine, follow these steps:
Clone Spacefarer to a desired location (folder) on your machine by opening up a terminal from the folder and entering the following command:
git clone https://github.com/ravi-aratchige/spacefarer.git
Next, move into the spacefarer
project directory:
cd spacefarer
A virtual environment will help you keep Spacefarer's dependencies isolated from the global system of Python packages. To setup your virtual environment, first ensure that virtualenv
is installed on your system:
pip install virtualenv
To create and activate a virtual environment, enter the following commands after moving into the spacefarer
folder as done in the previous step:
# Create a virtual environment named 'env':
python -m venv env
# Activate the virtual environment (Windows):
env\Scripts\activate.bat
# Activate the virtual environment (MacOS / Linux):
source env/bin/activate
Your terminal will now include an (env)
prefix, indicating a successful activation of the virtual environment:
# On Windows:
(env) drive:\folder\...spacefarer>
# On MacOS and Linux
(env) user@computer:~/...spacefarer$
To deactivate the virtual environment (and remove the (env)
prefix):
deactivate
After activating the virtual environment, you can install all of the necessary dependencies with a single command:
pip install -r requirements.txt
requirements.txt
includes all of the project's dependencies and their respective versions.
Move from the root of the project into the app
directory (where the Flask app is stored in):
cd app
Then, install the necessary NPM packages. This is essential for TailwindCSS:
npm install
# or
npm i
Finally, start up the Flask server:
python app.py
# or
python3 app.py
Flask will then serve Spacefarer on http://localhost:5000 (development server).
This project is fully open-source (including data and the model). Contributions are always welcome; you may fork this project, work on it and submit a pull request.
IMPORTANT: during development, the TailwindCSS build process must be started (for automatic purging and optimization).
For this, first enter the app
folder in the project directory (after activating the virtual environment):
cd app
Then, run the following command:
npm run create-css
This project is still underway, so you can expect changes often!
- Create 'About page' (
/about
) - Add particles.js to background of Flask app
- Optimize
form.html
using loops in Jinja blocks
Made with ❤️ by Ravindu Aratchige. Licensed under the Apache License.