-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f21a141
Showing
34 changed files
with
64,136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
artifacts/ | ||
prediction_artifacts/ | ||
predictions/ | ||
logs/ | ||
notebooks/ | ||
env/ | ||
LICENSE | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
name: workflow | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- 'README.md' | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
jobs: | ||
integration: | ||
name: Continuous Integration | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Lint code | ||
run: echo "Linting repository" | ||
|
||
- name: Run unit tests | ||
run: echo "Running unit tests" | ||
|
||
build-and-push-ecr-image: | ||
name: Continuous Delivery | ||
needs: integration | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Utilities | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y jq unzip | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Build, tag, and push image to Amazon ECR | ||
id: build-image | ||
env: | ||
IMAGE_TAG: latest | ||
run: | | ||
# Build a docker container and | ||
# push it to ECR so that it can | ||
# be deployed to ECS. | ||
docker build -t ${{ secrets.AWS_ECR_REPO_URI }}:$IMAGE_TAG . | ||
docker push ${{ secrets.AWS_ECR_REPO_URI }}:$IMAGE_TAG | ||
Continuous-Deployment: | ||
needs: build-and-push-ecr-image | ||
runs-on: self-hosted | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
|
||
- name: Pull latest images | ||
run: | | ||
docker pull ${{ secrets.AWS_ECR_REPO_URI }}:latest | ||
# - name: Stop and remove visibility container if running | ||
# run: | | ||
# docker ps -q --filter "name=visibility" | grep -q . && docker stop visibility && docker rm -fv visibility | ||
- name: Run Docker Image to serve users | ||
run: | | ||
docker run -d -p 5000:5000 --name=sensor -e 'AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}' -e 'AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}' -e 'AWS_DEFAULT_REGION=${{ secrets.AWS_DEFAULT_REGION }}' ${{ secrets.AWS_ECR_REPO_URI }}:latest | ||
- name: Clean previous images and containers | ||
run: | | ||
docker system prune -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
demo.py | ||
artifacts/ | ||
logs/ | ||
*.pkl | ||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
catboost_info | ||
.catboost_info/ | ||
catboost_info/ | ||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
demo.py | ||
artifacts | ||
prediction_artifacts | ||
predictions | ||
test.ipynb | ||
|
||
#test | ||
#$$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM python:3.8-slim-buster | ||
|
||
WORKDIR /app | ||
|
||
COPY . /app | ||
|
||
RUN pip install -r requirements.txt | ||
|
||
CMD [ "python3","app.py" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# 📄✏ Sensor Fault Detection Project | ||
**Brief:** In electronics, a **wafer** (also called a slice or substrate) is a thin slice of semiconductor, such as a crystalline silicon (c-Si), used for the fabrication of integrated circuits and, in photovoltaics, to manufacture solar cells. The wafer serves as the substrate(serves as foundation for contruction of other components) for microelectronic devices built in and upon the wafer. | ||
|
||
It undergoes many microfabrication processes, such as doping, ion implantation, etching, thin-film deposition of various materials, and photolithographic patterning. Finally, the individual microcircuits are separated by wafer dicing and packaged as an integrated circuit. | ||
|
||
#### Dataset is taken from Kaggle and stored in mongodb | ||
|
||
|
||
💿 Installing | ||
1. Environment setup. | ||
``` | ||
conda create --prefix venv python==3.8 -y | ||
``` | ||
``` | ||
conda activate venv/ | ||
```` | ||
2. Install Requirements and setup | ||
``` | ||
pip install -r requirements.txt | ||
``` | ||
5. Run Application | ||
``` | ||
python app.py | ||
``` | ||
|
||
🔧 Built with | ||
- flask | ||
- Python 3.8 | ||
- Machine learning | ||
- Scikit learn | ||
- 🏦 Industrial Use Cases | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
from flask import Flask, render_template, jsonify, request, send_file | ||
from flask_cors import CORS, cross_origin | ||
from src.exception import CustomException | ||
from src.logger import logging as lg | ||
import os,sys | ||
|
||
from src.pipeline.train_pipeline import TraininingPipeline | ||
from src.pipeline.predict_pipeline import PredictionPipeline | ||
|
||
app = Flask(__name__) | ||
|
||
@cross_origin | ||
@app.route("/") | ||
def home(): | ||
return "Welcome to my application" | ||
|
||
@cross_origin | ||
@app.route("/train") | ||
def train_route(): | ||
try: | ||
train_pipeline = TraininingPipeline() | ||
train_pipeline.run_pipeline() | ||
|
||
return "Training Completed." | ||
|
||
except Exception as e: | ||
raise CustomException(e,sys) | ||
|
||
|
||
@cross_origin | ||
@app.route('/predict', methods=['POST', 'GET']) | ||
def upload(): | ||
|
||
try: | ||
|
||
|
||
if request.method == 'POST': | ||
# it is a object of prediction pipeline | ||
prediction_pipeline = PredictionPipeline(request) | ||
|
||
#now we are running this run pipeline method | ||
prediction_file_detail = prediction_pipeline.run_pipeline() | ||
|
||
lg.info("prediction completed. Downloading prediction file.") | ||
return send_file(prediction_file_detail.prediction_file_path, | ||
download_name= prediction_file_detail.prediction_file_name, | ||
as_attachment= True) | ||
|
||
|
||
else: | ||
return render_template('upload_file.html') | ||
except Exception as e: | ||
raise CustomException(e,sys) | ||
|
||
|
||
#execution will start from here | ||
if __name__ == "__main__": | ||
app.run(host="0.0.0.0", port = 5000) |
Oops, something went wrong.