https://github.com/ravi-aratchige/spacefarer
What type of astronaut would you be?
https://github.com/ravi-aratchige/spacefarer
astronaut astronauts flask jupyter jupyter-notebook machine-learning numpy pandas python scikit-learn space tailwind tailwindcss
Last synced: 2 months ago
JSON representation
What type of astronaut would you be?
- Host: GitHub
- URL: https://github.com/ravi-aratchige/spacefarer
- Owner: ravi-aratchige
- License: apache-2.0
- Created: 2023-06-23T19:30:43.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-11T11:38:41.000Z (almost 3 years ago)
- Last Synced: 2025-10-14T21:36:00.869Z (8 months ago)
- Topics: astronaut, astronauts, flask, jupyter, jupyter-notebook, machine-learning, numpy, pandas, python, scikit-learn, space, tailwind, tailwindcss
- Language: Jupyter Notebook
- Homepage:
- Size: 10.4 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spacefarer :rocket:

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:
1. **Navigator** - steers and guides the spacecraft in the vast depths of space.
2. **Communicator** - maintains contact with stations and other spacecrafts.
3. **Explorer** - ventures boldly into uncharted realms and territories.
4. **Commander** - leading the spacecraft, its crew and their operation.
5. **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**:
1. Openness
2. Neuroticism
3. Conscientiousness
4. Agreeableness
5. 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%**.
## Setup
### Prerequisites
Spacefarer has very few prerequisites, which are probably already installed on your system:
1. Git version control system
2. Python (recommended to have a version greater than 3.9.0)
3. Node.js (recommended to have a version greater than 18.0.0)
To run Spacefarer locally on your machine, follow these steps:
### 1. Clone Project
Clone Spacefarer to a desired location (folder) on your machine by opening up a terminal from the folder and entering the following command:
```shell
git clone https://github.com/ravi-aratchige/spacefarer.git
```
Next, move into the `spacefarer` project directory:
```shell
cd spacefarer
```
### 2. Activate Virtual Environment
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:
```shell
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:
```shell
# 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:
```shell
# On Windows:
(env) drive:\folder\...spacefarer>
# On MacOS and Linux
(env) user@computer:~/...spacefarer$
```
To deactivate the virtual environment (and remove the `(env)` prefix):
```shell
deactivate
```
### 3. Install Dependencies
After activating the virtual environment, you can install all of the necessary dependencies with a single command:
```shell
pip install -r requirements.txt
```
`requirements.txt` includes all of the project's dependencies and their respective versions.
### 4. Start Flask App
Move from the root of the project into the `app` directory (where the Flask app is stored in):
```shell
cd app
```
Then, install the necessary NPM packages. This is essential for TailwindCSS:
```shell
npm install
# or
npm i
```
Finally, start up the Flask server:
```shell
python app.py
# or
python3 app.py
```
Flask will then serve Spacefarer on http://localhost:5000 (development server).
## Contribution
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):
```shell
cd app
```
Then, run the following command:
```shell
npm run create-css
```
This project is still underway, so you can expect changes often!
### To-Do
- [ ] Create 'About page' (`/about`)
- [ ] Add particles.js to background of Flask app
- [ ] Optimize `form.html` using loops in Jinja blocks
---
Made with :heart: by Ravindu Aratchige. Licensed under the Apache License.