-
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
ShubhamMohanty680
committed
Dec 5, 2023
1 parent
a1ab4b7
commit 3ea7460
Showing
159 changed files
with
25,891 additions
and
36 deletions.
There are no files selected for viewing
Empty file.
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,98 @@ | ||
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_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: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY_NAME }} | ||
IMAGE_TAG: latest | ||
run: | | ||
# Build a docker container and | ||
# push it to ECR so that it can | ||
# be deployed to ECS. | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$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_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_LOGIN_URI}}/${{ secrets.ECR_REPOSITORY_NAME }}:latest | ||
# - name: Stop and remove container if running | ||
# run: | | ||
# docker ps -q --filter "name=sign" | grep -q . && docker stop sign && docker rm -fv sign | ||
|
||
- name: Run Docker Image to serve users | ||
run: | | ||
docker run -d -p 8080:8080 --ipc="host" --name=sign -e 'AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}' -e 'AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}' -e 'AWS_REGION=${{ secrets.AWS_REGION }}' ${{secrets.AWS_ECR_LOGIN_URI}}/${{ secrets.ECR_REPOSITORY_NAME }}: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
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 @@ | ||
FROM python:3.7-slim-buster | ||
WORKDIR /app | ||
COPY . /app | ||
|
||
RUN apt update -y && apt install awscli -y | ||
|
||
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 unzip -y && 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
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 |
---|---|---|
@@ -1 +1,5 @@ | ||
# Yolov5-app-deployment-AWS | ||
# YOLO web app | ||
|
||
|
||
691871769154.dkr.ecr.eu-north-1.amazonaws.com/yoloapp | ||
|
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,69 @@ | ||
import sys,os | ||
from signLanguage.utils.main_utils import decodeImage, encodeImageIntoBase64 | ||
from flask import Flask, request, jsonify, render_template,Response | ||
from flask_cors import CORS, cross_origin | ||
|
||
|
||
app = Flask(__name__) | ||
CORS(app) | ||
|
||
class ClientApp: | ||
def __init__(self): | ||
self.filename = "inputImage.jpg" | ||
|
||
|
||
|
||
|
||
@app.route("/") | ||
def home(): | ||
return render_template("index.html") | ||
|
||
|
||
|
||
@app.route("/predict", methods=['POST','GET']) | ||
@cross_origin() | ||
def predictRoute(): | ||
try: | ||
image = request.json['image'] | ||
decodeImage(image, clApp.filename) | ||
|
||
os.system("cd yolov5/ && python detect.py --weights best.pt --img 416 --conf 0.5 --source ../data/inputImage.jpg") | ||
|
||
opencodedbase64 = encodeImageIntoBase64("yolov5/runs/detect/exp/inputImage.jpg") | ||
result = {"image": opencodedbase64.decode('utf-8')} | ||
os.system("rm -rf yolov5/runs") | ||
|
||
except ValueError as val: | ||
print(val) | ||
return Response("Value not found inside json data") | ||
except KeyError: | ||
return Response("Key value error incorrect key passed") | ||
except Exception as e: | ||
print(e) | ||
result = "Invalid input" | ||
|
||
return jsonify(result) | ||
|
||
|
||
|
||
|
||
@app.route("/live", methods=['GET']) | ||
@cross_origin() | ||
def predictLive(): | ||
try: | ||
os.system("cd yolov5/ && python detect.py --weights best.pt --img 416 --conf 0.5 --source 0") | ||
os.system("rm -rf yolov5/runs") | ||
return "Camera starting!!" | ||
|
||
except ValueError as val: | ||
print(val) | ||
return Response("Value not found inside json data") | ||
|
||
|
||
|
||
|
||
|
||
|
||
if __name__ == "__main__": | ||
clApp = ClientApp() | ||
app.run(host="0.0.0.0", port=8080) |
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,56 @@ | ||
dill==0.3.5.1 | ||
from-root==1.0.2 | ||
notebook==7.0.0a7 | ||
flask-cors | ||
flask | ||
|
||
# YOLOv5 requirements | ||
# Usage: pip install -r requirements.txt | ||
|
||
# Base ---------------------------------------- | ||
matplotlib>=3.2.2 | ||
numpy>=1.18.5 | ||
opencv-python>=4.1.1 | ||
Pillow>=7.1.2 | ||
PyYAML>=5.3.1 | ||
requests>=2.23.0 | ||
scipy>=1.4.1 | ||
torch>=1.7.0 # see https://pytorch.org/get-started/locally/ (recommended) | ||
torchvision>=0.8.1 | ||
tqdm>=4.64.0 | ||
# protobuf<=3.20.1 # https://github.com/ultralytics/yolov5/issues/8012 | ||
|
||
# Logging ------------------------------------- | ||
tensorboard>=2.4.1 | ||
# clearml>=1.2.0 | ||
# comet | ||
|
||
# Plotting ------------------------------------ | ||
pandas>=1.1.4 | ||
seaborn>=0.11.0 | ||
|
||
# Export -------------------------------------- | ||
# coremltools>=6.0 # CoreML export | ||
# onnx>=1.9.0 # ONNX export | ||
# onnx-simplifier>=0.4.1 # ONNX simplifier | ||
# nvidia-pyindex # TensorRT export | ||
# nvidia-tensorrt # TensorRT export | ||
# scikit-learn<=1.1.2 # CoreML quantization | ||
# tensorflow>=2.4.1 # TF exports (-cpu, -aarch64, -macos) | ||
# tensorflowjs>=3.9.0 # TF.js export | ||
# openvino-dev # OpenVINO export | ||
|
||
# Deploy -------------------------------------- | ||
# tritonclient[all]~=2.24.0 | ||
|
||
# Extras -------------------------------------- | ||
ipython # interactive notebook | ||
psutil # system utilization | ||
thop>=0.1.1 # FLOPs computation | ||
# mss # screenshots | ||
# albumentations>=1.0.3 | ||
# pycocotools>=2.0 # COCO mAP | ||
# roboflow | ||
|
||
|
||
-e . |
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,11 @@ | ||
from setuptools import find_packages, setup | ||
|
||
setup( | ||
name = 'signLanguages', | ||
version= '0.0.0', | ||
author= 'iNeuron', | ||
author_email= '[email protected]', | ||
packages= find_packages(), | ||
install_requires = [] | ||
|
||
) |
Empty file.
Empty file.
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,16 @@ | ||
import os.path | ||
import sys | ||
import yaml | ||
import base64 | ||
|
||
|
||
def decodeImage(imgstring, fileName): | ||
imgdata = base64.b64decode(imgstring) | ||
with open("./data/" + fileName, 'wb') as f: | ||
f.write(imgdata) | ||
f.close() | ||
|
||
|
||
def encodeImageIntoBase64(croppedImagePath): | ||
with open(croppedImagePath, "rb") as f: | ||
return base64.b64encode(f.read()) |
Oops, something went wrong.