Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 2 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ jobs:
src:
- 'Datasets/**'
- '.github/workflows/docker.yml'
- 'app.py'
- 'app/**'
- 'Dockerfile'
- 'requirements.txt'
- 'templates/**'
- 'static/**'
- 'models/**'
- 'notebooks/**'
- 'scripts/**'
- 'fit.py'
- '.dockerignore'

docker-build:
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ jobs:
with:
filters: |
src:
- 'app.py'
- 'fit.py'
- 'app/**'
- 'models/fit.py'
- 'requirements.txt'
- 'templates/**'
- 'static/**'
- 'models/**'
- 'notebooks/**'
- 'scripts/**'
- 'Datasets/**'
- '.github/workflows/python-app.yml'
Expand All @@ -56,10 +54,10 @@ jobs:
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
- name: Run FastAPI app and test with Curl
run: |
nohup python app.py &
nohup uvicorn app.app:app &
sleep 10
curl -I http://127.0.0.1:5000
pkill -f "python app.py"
curl -I http://127.0.0.1:8000
pkill -f uvicorn

7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ RUN pip install --upgrade pip && pip install -r requirements.txt
COPY . .

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

# run the flask app
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app", "--workers", "2"]
# run the fastapi app with gunicorn and uvicorn workers
CMD ["gunicorn", "-w", "2", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8000", "app.app:app"]
45 changes: 26 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,59 +85,66 @@ CosmoClassifier/
│ ├─ check.yml
│ ├─ docker.yml
│ └─ python-app.yml
├─ app/
│ ├─ schema/
│ │ └─ validation.py
│ ├─ static/
│ │ ├─ confusion_matrix.png
│ │ ├─ conf_mat.py
│ │ ├─ script.js
│ │ └─ style.css
│ ├─ templates/
│ │ └─ index.html
│ ├─ app.py
│ └─ __init__.py
├─ Datasets/
│ └─ SDSS_DR18.csv
├─ models/
│ ├─ __init__.py
│ ├─ fit.py
│ ├─ column_names.pkl
│ └─ estimator.pkl
├─ notebooks/
│ ├─ __init__.py
│ ├─ research_2.py
│ └─ research.py
├─ reports/
│ ├─ research_2.html
│ └─ research.html
├─ screenshots/
│ ├─ ss_filled.png
│ └─ ss_home.png
├─ static/
│ ├─ confusion_matrix.png
│ ├─ script.js
│ └─ style.css
├─ templates/
│ └─ index.html
├─ .dockerignore
├─ .env.example
├─ .gitattributes
├─ .gitignore
├─ app.py
├─ conf_mat.py
├─ Dockerfile
├─ fit.py
├─ health_checker.py
├─ LICENSE
├─ README.md
├─ requirements.txt
├─ research_2.py
└─ research.py
└─ requirements.txt

```
---
## 💻 Installation & Usage

### 1️⃣ Clone the Repository
```bash
git clone https://github.com/ByteBard58/The_CosmoClassifier
cd The_CosmoClassifier
git clone https://github.com/ByteBard58/CosmoClassifier
cd CosmoClassifier
```
### 2️⃣ Install Dependencies
```bash
pip install -r requirements.txt
```
### 3️⃣ Run the App
```bash
python app.py
uvicorn app.app:app --reload
```

### 4️⃣ Run Marimo Notebooks (Optional)
To explore the research notebooks interactively:
```bash
cd notebooks/
marimo edit research.py
# OR
marimo edit research_2.py
Expand All @@ -159,14 +166,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/cosmoclassifier:latest
docker run --rm -p 5000:5000 bytebard101/cosmoclassifier:latest
docker run --rm -p 8000:8000 bytebard101/cosmoclassifier: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/cosmoclassifier:latest
docker run --rm -p 8001:8000 bytebard101/cosmoclassifier: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:8000/) if you followed Step 3).

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

Expand Down
117 changes: 0 additions & 117 deletions app.py

This file was deleted.

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