Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
9982c5d
Refactor project structure and move app-specific files to the newly c…
ByteBard58 Apr 13, 2026
902f40d
Rename older flask-powered app script and create new one for fastapi
ByteBard58 Apr 13, 2026
8f2e121
Add primary self-heal function and configuration in `app.py` and add …
ByteBard58 Apr 13, 2026
5974eee
Add fully configured pydantic `BaseModel` for input validation on `/p…
ByteBard58 Apr 13, 2026
ddbc8d5
Update `requirements.txt` to add `fastapi` and other dependencies
ByteBard58 Apr 13, 2026
d77f204
Add `/about`,`/predict` and `/predict/batch` endpoints for both regul…
ByteBard58 Apr 13, 2026
0386234
Add sample generator script and modify `.gitignore` to ignore generat…
ByteBard58 Apr 13, 2026
b9ec8af
Fix typo in docstring of `sample_generator.py`
ByteBard58 Apr 13, 2026
cfbb4a3
Debug some issues in `app.py`,
ByteBard58 Apr 13, 2026
205b558
Modify path filtering configuration in the CI scripts
ByteBard58 Apr 13, 2026
2eaa837
Replace older gunicorn setup with uvicorn for fastapi
ByteBard58 Apr 13, 2026
145c150
Update the dependency list by getting rid of no-longer required libra…
ByteBard58 Apr 13, 2026
6bb216b
Delete older flask-based app
ByteBard58 Apr 13, 2026
38a0817
Link the existing vanilla frontend with the fastapi app, implement no…
ByteBard58 Apr 13, 2026
be0b19a
Enhance UI with tab navigation, batch prediction functionality, and i…
ByteBard58 Apr 13, 2026
7229cc3
Implement integration test suite with FastAPI TestClient and model mo…
ByteBard58 Apr 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ jobs:
- "Dockerfile"
- ".dockerignore"
- "requirements.txt"
- "fit.py"
- "app.py"
- "templates/**"
- "static/**"
- "app/**"
- "models/**"

docker-build:
Expand Down
19 changes: 7 additions & 12 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ jobs:
with:
filters: |
src:
- ".github/workflows/docker.yml"
- ".github/workflows/python-app.yml"
- "data/**"
- "requirements.txt"
- "app/**"
- "models/**"
- "static/**"
- "templates/**"
- "app.py"
- "fit.py"
- "tests/**"

build:
needs: changes
Expand All @@ -46,17 +45,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install flake8 pytest httpx
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run Flask app and test with Curl
run: |
nohup python app.py &
sleep 95
curl -I http://127.0.0.1:5000
pkill -f "python app.py"
- name: Run tests with pytest
run: pytest
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ instance/
shit/
*.db
.vscode/
*.pkl
*.pkl
data/test_sample.csv
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Dockerfile (exoplanet_classifier)
# Dockerfile (TransitIQ)
FROM python:3.11-slim

# Avoid interactive prompts
Expand All @@ -14,10 +14,9 @@ RUN pip install --upgrade pip && pip install -r requirements.txt
# copy app source
COPY . .

# example env and port
ENV FLASK_APP=app.py
EXPOSE 5000
# expose port
EXPOSE 8000

# run the flask app
CMD ["python", "-m", "gunicorn", "--bind", "0.0.0.0:5000", "app:app", "--workers", "2"]
# run the fastapi app
CMD ["uvicorn", "app.app:app", "--host", "0.0.0.0", "--port", "8000"]

41 changes: 19 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ This version blends the strengths of **ensemble learning** with extensive prepro
NASA’s exoplanet survey missions (Kepler, K2, and others) have generated thousands of data points using **the transit method** — tracking dips in starlight caused by orbiting planets.
These datasets contain both **confirmed exoplanets** and **false positives**, and the aim of this project is to build an AI classifier capable of making preliminary predictions on new candidates.

The classifier runs inside a **Flask-powered web interface**, allowing anyone — from students to researchers — to enter transit parameters and instantly receive a prediction.
The classifier runs inside a **FastAPI-powered web interface**, allowing anyone — from students to researchers — to enter transit parameters and instantly receive a prediction.

The goal is to provide a *scientifically meaningful, intuitive, and educational experience* for users interested in exoplanet research.

Expand Down Expand Up @@ -68,8 +68,8 @@ The goal is to provide a *scientifically meaningful, intuitive, and educational
- **Scikit-learn** – Pipeline, scaling, imputation, model stacking, metrics
- **XGBoost** – Gradient boosting-based sub-model for ensemble
- **Imbalanced-learn (SMOTE)** – Class balancing for improved fairness
- **Flask** – Backend web framework
- **HTML/CSS/JavaScript** – Frontend for the interactive web UI
- **FastAPI** – Backend web framework
- **HTML/CSS/JavaScript (Vanilla)** – Frontend for the interactive web UI
- **Jupyter Notebook** – Used as a sandbox (`research.ipynb`) to experiment with different model architectures, hyperparameters, and feature engineering before finalizing `fit.py`.

---
Expand All @@ -93,14 +93,14 @@ cd "TransitIQ"
pip install -r requirements.txt
```

3. **Run the Flask app**
3. **Run the FastAPI app**

```bash
python app.py
uvicorn app.app:app --host 0.0.0.0 --port 8000
```
4. Open your browser and go to `http://127.0.0.1:5000` to access the web interface.
4. Open your browser and go to `http://127.0.0.1:8000` to access the web interface.

5. If you want to close the server, press `Ctrl + C` in the terminal where you have run `app.py` from.
5. If you want to close the server, press `Ctrl + C` in the terminal.

---

Expand All @@ -114,14 +114,14 @@ The image is built on both ARM64 and AMD64 architectures, so that it can run on
2. Open Terminal and run:
```bash
docker pull bytebard101/exoplanet_classifier
docker run --rm -p 5000:5000 bytebard101/exoplanet_classifier:latest
docker run --rm -p 8000:8000 bytebard101/exoplanet_classifier:latest
```
3. If your machine faces a port conflict, you will need to assign another port. Try to run this:
```bash
docker run --rm -p 5001:5000 bytebard101/exoplanet_classifier:latest
docker run --rm -p 8001:8000 bytebard101/exoplanet_classifier:latest
```
> If you followed Step 2 and the command ran successfully, then **DO NOT** follow this step.
4. The app will be live at localhost:5000. Open your browser and navigate to [http://127.0.0.1:5000](http://127.0.0.1:5000/) (or [http://127.0.0.1:5001](http://127.0.0.1:5000/) if you followed Step 3).
4. The app will be live at localhost:8000. Open your browser and navigate to [http://127.0.0.1:8000](http://127.0.0.1:8000/) (or [http://127.0.0.1:8001](http://127.0.0.1:8001/) if you followed Step 3).

Check [Docker Documentation](https://docs.docker.com/) to learn more about Docker and it's commands.

Expand All @@ -146,31 +146,28 @@ Check [Docker Documentation](https://docs.docker.com/) to learn more about Docke
TransitIQ/
├── .github/ # Folder for GitHub actions
├── app/ # FastAPI Application
│ ├── schema/ # Pydantic schemas
│ ├── static/ # Static assets (CSS, JS, images)
│ ├── templates/ # HTML templates (served as static)
│ └── app.py # Main FastAPI entry point
├── data/
│ ├── k2_data.csv
│ ├── kepler_data.csv
│ └── source.txt
├── models/
│ ├── column_names.pkl # Not included in the repo, run fit.py to generate
│ ├── column_names.pkl
│ ├── info.txt
│ └── pipe.pkl # Not included in the repo, run fit.py to generate
│ └── pipe.pkl
├── screenshots/
├── static/
│ ├── materials/
│ └── script.js
├── templates/
│ ├── about.html
│ └── index.html
├── .gitignore
├── app.py
├── fit.py
├── LICENSE
├── README.md # You're reading it now
├── README.md
├── requirements.txt
└── research.ipynb
```
Expand Down
118 changes: 0 additions & 118 deletions app.py

This file was deleted.

Empty file added app/__init__.py
Empty file.
Loading
Loading