Upload 3 files
Browse files- Dockerfile +27 -27
- app.py +251 -248
- requirements.txt +0 -0
Dockerfile
CHANGED
|
@@ -1,27 +1,27 @@
|
|
| 1 |
-
FROM python:3.10-slim
|
| 2 |
-
|
| 3 |
-
# System dependencies
|
| 4 |
-
RUN apt-get update && apt-get install -y \
|
| 5 |
-
libgl1 \
|
| 6 |
-
libglib2.0-0 \
|
| 7 |
-
wget \
|
| 8 |
-
unzip \
|
| 9 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
-
|
| 11 |
-
# Install ngrok manually and set permission
|
| 12 |
-
RUN wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip && \
|
| 13 |
-
unzip ngrok-stable-linux-amd64.zip -d /usr/local/bin && \
|
| 14 |
-
chmod +x /usr/local/bin/ngrok && \
|
| 15 |
-
rm ngrok-stable-linux-amd64.zip
|
| 16 |
-
|
| 17 |
-
# Set matplotlib config dir to avoid permission issues
|
| 18 |
-
ENV MPLCONFIGDIR=/tmp/matplotlib
|
| 19 |
-
|
| 20 |
-
WORKDIR /app
|
| 21 |
-
COPY requirements.txt requirements.txt
|
| 22 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 23 |
-
COPY . .
|
| 24 |
-
|
| 25 |
-
EXPOSE 7860
|
| 26 |
-
|
| 27 |
-
CMD ["python", "app.py"]
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
# System dependencies
|
| 4 |
+
RUN apt-get update && apt-get install -y \
|
| 5 |
+
libgl1 \
|
| 6 |
+
libglib2.0-0 \
|
| 7 |
+
wget \
|
| 8 |
+
unzip \
|
| 9 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
+
|
| 11 |
+
# Install ngrok manually and set permission
|
| 12 |
+
RUN wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip && \
|
| 13 |
+
unzip ngrok-stable-linux-amd64.zip -d /usr/local/bin && \
|
| 14 |
+
chmod +x /usr/local/bin/ngrok && \
|
| 15 |
+
rm ngrok-stable-linux-amd64.zip
|
| 16 |
+
|
| 17 |
+
# Set matplotlib config dir to avoid permission issues
|
| 18 |
+
ENV MPLCONFIGDIR=/tmp/matplotlib
|
| 19 |
+
|
| 20 |
+
WORKDIR /app
|
| 21 |
+
COPY requirements.txt requirements.txt
|
| 22 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 23 |
+
COPY . .
|
| 24 |
+
|
| 25 |
+
EXPOSE 7860
|
| 26 |
+
|
| 27 |
+
CMD ["python", "app.py"]
|
app.py
CHANGED
|
@@ -1,253 +1,254 @@
|
|
| 1 |
from flask import Flask, request, send_file
|
| 2 |
-
from flask_ngrok import run_with_ngrok
|
| 3 |
from io import BytesIO
|
| 4 |
import mimetypes
|
| 5 |
-
import cv2
|
| 6 |
-
import numpy as np
|
| 7 |
-
import mediapipe as mp
|
| 8 |
-
import math
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
#
|
|
|
|
| 251 |
|
| 252 |
|
| 253 |
|
|
@@ -256,7 +257,9 @@ ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}
|
|
| 256 |
def allowed_file(filename):
|
| 257 |
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
| 258 |
app = Flask(__name__)
|
| 259 |
-
run_with_ngrok(app) # This will use ngrok for the server
|
|
|
|
|
|
|
| 260 |
|
| 261 |
@app.route('/')
|
| 262 |
def hello():
|
|
|
|
| 1 |
from flask import Flask, request, send_file
|
| 2 |
+
# from flask_ngrok import run_with_ngrok
|
| 3 |
from io import BytesIO
|
| 4 |
import mimetypes
|
| 5 |
+
# import cv2
|
| 6 |
+
# import numpy as np
|
| 7 |
+
# import mediapipe as mp
|
| 8 |
+
# import math
|
| 9 |
+
from pyngrok import ngrok
|
| 10 |
+
|
| 11 |
+
# def calculate_angle(point1, point2, point3):
|
| 12 |
+
# """
|
| 13 |
+
# Calculates the angle at point2 formed by the lines connecting it to point1 and point3.
|
| 14 |
+
|
| 15 |
+
# Args:
|
| 16 |
+
# point1 (tuple): Coordinates (x, y) of the first point.
|
| 17 |
+
# point2 (tuple): Coordinates (x, y) of the vertex (the point where the angle is).
|
| 18 |
+
# point3 (tuple): Coordinates (x, y) of the third point.
|
| 19 |
+
|
| 20 |
+
# Returns:
|
| 21 |
+
# float: The angle in degrees.
|
| 22 |
+
# """
|
| 23 |
+
# x1, y1 = point1
|
| 24 |
+
# x2, y2 = point2
|
| 25 |
+
# x3, y3 = point3
|
| 26 |
+
|
| 27 |
+
# # Calculate vectors
|
| 28 |
+
# vector1 = (x1 - x2, y1 - y2)
|
| 29 |
+
# vector2 = (x3 - x2, y3 - y2)
|
| 30 |
+
|
| 31 |
+
# # Calculate dot product
|
| 32 |
+
# dot_product = vector1[0] * vector2[0] + vector1[1] * vector2[1]
|
| 33 |
+
|
| 34 |
+
# # Calculate magnitudes (lengths) of the vectors
|
| 35 |
+
# magnitude1 = math.sqrt(vector1[0]**2 + vector1[1]**2)
|
| 36 |
+
# magnitude2 = math.sqrt(vector2[0]**2 + vector2[1]**2)
|
| 37 |
+
|
| 38 |
+
# # Calculate cosine of the angle
|
| 39 |
+
# if magnitude1 == 0 or magnitude2 == 0:
|
| 40 |
+
# return 0.0 # Handle cases where points are the same
|
| 41 |
+
# cos_theta = dot_product / (magnitude1 * magnitude2)
|
| 42 |
+
|
| 43 |
+
# # Ensure cos_theta is within the valid range [-1, 1] due to potential floating-point errors
|
| 44 |
+
# cos_theta = max(-1.0, min(1.0, cos_theta))
|
| 45 |
+
|
| 46 |
+
# # Calculate the angle in radians and convert to degrees
|
| 47 |
+
# angle_radians = math.acos(cos_theta)
|
| 48 |
+
# angle_degrees = math.degrees(angle_radians)
|
| 49 |
+
|
| 50 |
+
# return angle_degrees
|
| 51 |
+
|
| 52 |
+
# # Function to extract the coordinates of a landmark
|
| 53 |
+
# def get_landmark_coordinates(landmarks, landmark_id):
|
| 54 |
+
# try:
|
| 55 |
+
# x = landmarks.landmark[landmark_id].x
|
| 56 |
+
# y = landmarks.landmark[landmark_id].y
|
| 57 |
+
# x=x/1
|
| 58 |
+
# y=y/1
|
| 59 |
+
# return np.array([x, y])
|
| 60 |
+
# except:
|
| 61 |
+
# return np.array([0, 0]) # Return [0, 0] if landmark is not detected
|
| 62 |
+
|
| 63 |
+
# mp_pose = mp.solutions.pose
|
| 64 |
+
# pose = mp_pose.Pose(min_detection_confidence=0.5, min_tracking_confidence=0.5)
|
| 65 |
+
# mp_drawing = mp.solutions.drawing_utils
|
| 66 |
+
|
| 67 |
+
# def calculate_angles_landmarks(landmarks):
|
| 68 |
+
# # Left side angles
|
| 69 |
+
# left_shoulder = get_landmark_coordinates(landmarks, mp_pose.PoseLandmark.LEFT_SHOULDER)
|
| 70 |
+
# left_elbow = get_landmark_coordinates(landmarks, mp_pose.PoseLandmark.LEFT_ELBOW)
|
| 71 |
+
# left_wrist = get_landmark_coordinates(landmarks, mp_pose.PoseLandmark.LEFT_WRIST)
|
| 72 |
+
# #
|
| 73 |
+
# right_shoulder = get_landmark_coordinates(landmarks, mp_pose.PoseLandmark.RIGHT_SHOULDER)
|
| 74 |
+
# right_elbow = get_landmark_coordinates(landmarks, mp_pose.PoseLandmark.RIGHT_ELBOW)
|
| 75 |
+
# right_wrist = get_landmark_coordinates(landmarks, mp_pose.PoseLandmark.RIGHT_WRIST)
|
| 76 |
+
# #
|
| 77 |
+
# left_hip = get_landmark_coordinates(landmarks, mp_pose.PoseLandmark.LEFT_HIP)
|
| 78 |
+
# left_knee = get_landmark_coordinates(landmarks, mp_pose.PoseLandmark.LEFT_KNEE)
|
| 79 |
+
# #
|
| 80 |
+
# right_hip = get_landmark_coordinates(landmarks, mp_pose.PoseLandmark.RIGHT_HIP)
|
| 81 |
+
# right_knee = get_landmark_coordinates(landmarks, mp_pose.PoseLandmark.RIGHT_KNEE)
|
| 82 |
+
# #
|
| 83 |
+
# left_ankle = get_landmark_coordinates(landmarks,mp_pose.PoseLandmark.LEFT_ANKLE)
|
| 84 |
+
# right_ankle = get_landmark_coordinates(landmarks,mp_pose.PoseLandmark.RIGHT_ANKLE)
|
| 85 |
+
# #
|
| 86 |
+
|
| 87 |
+
# if np.any(left_shoulder) and np.any(left_elbow) and np.any(left_wrist):
|
| 88 |
+
# left_elbow_angle = calculate_angle(left_shoulder, left_elbow, left_wrist)
|
| 89 |
+
# else: left_elbow_angle = 0
|
| 90 |
+
|
| 91 |
+
# if np.any(left_shoulder) and np.any(left_hip) and np.any(left_knee):
|
| 92 |
+
# left_hip_angle = calculate_angle(left_shoulder, left_hip, left_knee)
|
| 93 |
+
# else: left_hip_angle = 0
|
| 94 |
+
|
| 95 |
+
# if np.any(right_shoulder) and np.any(right_elbow) and np.any(right_wrist):
|
| 96 |
+
# right_elbow_angle = calculate_angle(right_shoulder, right_elbow, right_wrist)
|
| 97 |
+
# else: right_elbow_angle = 0
|
| 98 |
+
|
| 99 |
+
# if np.any(right_shoulder) and np.any(right_hip) and np.any(right_knee):
|
| 100 |
+
# right_hip_angle = calculate_angle(right_shoulder, right_hip, right_knee)
|
| 101 |
+
# else: right_hip_angle = 0
|
| 102 |
+
|
| 103 |
+
# if np.any(right_knee) and np.any(right_ankle) and np.any(right_hip):
|
| 104 |
+
# right_knee_angle = calculate_angle(right_knee, right_ankle, right_hip)
|
| 105 |
+
# else: right_knee_angle = 0
|
| 106 |
+
|
| 107 |
+
# if np.any(left_knee) and np.any(left_ankle) and np.any(left_hip):
|
| 108 |
+
# left_knee_angle = calculate_angle(left_knee, left_ankle, left_hip)
|
| 109 |
+
# else: left_knee_angle = 0
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
# # Additional angles (e.g., shoulders, knees, etc.)
|
| 113 |
+
# head0 = 0
|
| 114 |
+
# num = 0
|
| 115 |
+
# head = get_landmark_coordinates(landmarks, mp_pose.PoseLandmark.NOSE)
|
| 116 |
+
# if not np.array_equal(head, head0): num += 1
|
| 117 |
+
# head0 = head
|
| 118 |
+
|
| 119 |
+
# head += get_landmark_coordinates(landmarks, mp_pose.PoseLandmark.RIGHT_EYE)
|
| 120 |
+
# if (head[0]==head0[0]) & (head[1]==head0[1]): num += 1
|
| 121 |
+
# head0 = head
|
| 122 |
+
|
| 123 |
+
# head += get_landmark_coordinates(landmarks, mp_pose.PoseLandmark.LEFT_EYE)
|
| 124 |
+
# if (head[0]==head0[0]) & (head[1]==head0[1]): num += 1
|
| 125 |
+
# head0 = head
|
| 126 |
+
|
| 127 |
+
# head += get_landmark_coordinates(landmarks, mp_pose.PoseLandmark.RIGHT_EAR)
|
| 128 |
+
# if (head[0]==head0[0]) & (head[1]==head0[1]): num += 1
|
| 129 |
+
# head0 = head
|
| 130 |
+
|
| 131 |
+
# head += get_landmark_coordinates(landmarks, mp_pose.PoseLandmark.LEFT_EAR)
|
| 132 |
+
# if (head[0]==head0[0]) & (head[1]==head0[1]): num += 1
|
| 133 |
+
# head0 = head
|
| 134 |
+
|
| 135 |
+
# head /= num
|
| 136 |
+
|
| 137 |
+
# if np.any(head) and np.any(left_shoulder) and np.any(left_elbow):
|
| 138 |
+
# left_arm_angle = calculate_angle(head, left_shoulder, left_elbow)
|
| 139 |
+
# else:
|
| 140 |
+
# left_arm_angle = 0
|
| 141 |
+
|
| 142 |
+
# if np.any(head) and np.any(right_shoulder) and np.any(right_elbow):
|
| 143 |
+
# right_arm_angle = calculate_angle(head, right_shoulder, right_elbow)
|
| 144 |
+
# else:
|
| 145 |
+
# right_arm_angle = 0
|
| 146 |
+
|
| 147 |
+
# if np.any(head) and np.any(left_shoulder) and np.any(left_hip):
|
| 148 |
+
# left_back_angle = calculate_angle(head, left_shoulder, left_hip)
|
| 149 |
+
# else:
|
| 150 |
+
# left_back_angle = 0
|
| 151 |
+
|
| 152 |
+
# if np.any(head) and np.any(right_shoulder) and np.any(right_hip):
|
| 153 |
+
# right_back_angle = calculate_angle(head, right_shoulder, right_hip)
|
| 154 |
+
# else:
|
| 155 |
+
# right_back_angle = 0
|
| 156 |
+
# ###############
|
| 157 |
+
# angles = {
|
| 158 |
+
# "left_elbow_angle": left_elbow_angle,
|
| 159 |
+
# "left_hip_angle": left_hip_angle,
|
| 160 |
+
# "right_elbow_angle": right_elbow_angle,
|
| 161 |
+
# "right_hip_angle": right_hip_angle,
|
| 162 |
+
# "left_arm_angle": left_arm_angle,
|
| 163 |
+
# "right_arm_angle": right_arm_angle,
|
| 164 |
+
# "left_back_angle": left_back_angle,
|
| 165 |
+
# "right_back_angle": right_back_angle,
|
| 166 |
+
# "left_knee_angle": left_knee_angle,
|
| 167 |
+
# "right_knee_angle": right_knee_angle
|
| 168 |
+
# }
|
| 169 |
+
|
| 170 |
+
# locations={
|
| 171 |
+
# "left_shoulder":left_shoulder,
|
| 172 |
+
# "left_elbow":left_elbow,
|
| 173 |
+
# "left_wrist":left_wrist,
|
| 174 |
+
# "right_shoulder":right_shoulder,
|
| 175 |
+
# "right_elbow":right_elbow,
|
| 176 |
+
# "right_wrist":right_wrist,
|
| 177 |
+
|
| 178 |
+
# "head":head,
|
| 179 |
+
|
| 180 |
+
# "left_hip":left_hip,
|
| 181 |
+
# "left_knee":left_knee,
|
| 182 |
+
# "left_ankle":left_ankle,
|
| 183 |
+
|
| 184 |
+
# "right_hip":right_hip,
|
| 185 |
+
# "right_knee":right_knee,
|
| 186 |
+
# "right_ankle":right_ankle
|
| 187 |
+
# }
|
| 188 |
+
# return angles,locations
|
| 189 |
+
|
| 190 |
+
# # Function to calculate the angles for both left and right sides and overlay on image
|
| 191 |
+
# def calculate_and_display_angles(image_path, return_angles=False):
|
| 192 |
+
# mp_pose = mp.solutions.pose
|
| 193 |
+
# pose = mp_pose.Pose(min_detection_confidence=0.5, min_tracking_confidence=0.5)
|
| 194 |
+
|
| 195 |
+
# image = cv2.imread(image_path)
|
| 196 |
+
# image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
| 197 |
+
|
| 198 |
+
# # Get pose landmarks
|
| 199 |
+
# results = pose.process(image_rgb)
|
| 200 |
+
|
| 201 |
+
# if results.pose_landmarks:
|
| 202 |
+
# # landmarks = results.pose_landmarks
|
| 203 |
+
# ########
|
| 204 |
+
# ang , locs = calculate_angles_landmarks(results.pose_landmarks)
|
| 205 |
+
|
| 206 |
+
# #if only angles needed
|
| 207 |
+
# if return_angles:
|
| 208 |
+
# return ang
|
| 209 |
+
|
| 210 |
+
# # Draw the pose landmarks on the image
|
| 211 |
+
# mp_drawing = mp.solutions.drawing_utils
|
| 212 |
+
# mp_drawing.draw_landmarks(image, results.pose_landmarks, mp_pose.POSE_CONNECTIONS)
|
| 213 |
+
|
| 214 |
+
# # Display the angle values at corresponding locations
|
| 215 |
+
# def overlay_angle(angle, location, color=(0, 255, 0)):
|
| 216 |
+
# # Coordinates are normalized, scale them to the image size
|
| 217 |
+
# x = int(location[0] * image.shape[1])
|
| 218 |
+
# y = int(location[1] * image.shape[0])
|
| 219 |
+
# cv2.putText(image, f'{angle:.2f}', (x, y), cv2.FONT_HERSHEY_SIMPLEX, 0.3, color, 1)
|
| 220 |
+
|
| 221 |
+
# # Overlay angles on the image
|
| 222 |
+
# if np.any(ang['left_elbow_angle']!=0):
|
| 223 |
+
# overlay_angle(ang['left_elbow_angle'], locs['left_elbow'], (0, 255, 0)) # Left elbow angle
|
| 224 |
+
# if np.any(ang['right_elbow_angle']!=0):
|
| 225 |
+
# overlay_angle(ang['right_elbow_angle'], locs['right_elbow'], (0, 255, 0)) # Right elbow angle
|
| 226 |
+
# if np.any(ang['left_hip_angle']!=0):
|
| 227 |
+
# overlay_angle(ang['left_hip_angle'], locs['left_hip'], (0, 255, 0)) # Left hip angle
|
| 228 |
+
# if np.any(ang['right_hip_angle']!=0):
|
| 229 |
+
# overlay_angle(ang['right_hip_angle'], locs['right_hip'], (0, 255, 0)) # Right hip angle
|
| 230 |
+
# if np.any(ang['left_arm_angle']!=0):
|
| 231 |
+
# overlay_angle(ang['left_arm_angle'], (locs['left_shoulder']
|
| 232 |
+
# + locs['left_elbow'])/2, (0, 255, 0)) # Left arm angle
|
| 233 |
+
# if np.any(ang['right_arm_angle']!=0):
|
| 234 |
+
# overlay_angle(ang['right_arm_angle'], (locs['right_shoulder']
|
| 235 |
+
# + locs['right_elbow'])/2, (0, 255, 0))
|
| 236 |
+
# if np.any(ang['left_back_angle']!=0):
|
| 237 |
+
# overlay_angle(ang['left_back_angle'], locs['left_shoulder'], (0, 255, 0)) # Left back angle
|
| 238 |
+
# if np.any(ang['right_back_angle']!=0):
|
| 239 |
+
# overlay_angle(ang['right_back_angle'], locs['right_shoulder'], (0, 255, 0)) # Right back angle
|
| 240 |
+
|
| 241 |
+
# if np.any(ang['left_knee_angle']!=0):
|
| 242 |
+
# overlay_angle(ang['left_knee_angle'], locs['left_knee'], (0, 255, 0)) # Left knee angle
|
| 243 |
+
|
| 244 |
+
# if np.any(ang['right_knee_angle']!=0):
|
| 245 |
+
# overlay_angle(ang['right_knee_angle'], locs['right_knee'], (0, 255, 0)) # Right knee angle
|
| 246 |
+
|
| 247 |
+
# # Return the image with the overlayed angles
|
| 248 |
+
# return image
|
| 249 |
+
# else:
|
| 250 |
+
# return None
|
| 251 |
+
# ###
|
| 252 |
|
| 253 |
|
| 254 |
|
|
|
|
| 257 |
def allowed_file(filename):
|
| 258 |
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
| 259 |
app = Flask(__name__)
|
| 260 |
+
# run_with_ngrok(app) # This will use ngrok for the server
|
| 261 |
+
public_url = ngrok.connect(5000)
|
| 262 |
+
print(" * ngrok tunnel:", public_url)
|
| 263 |
|
| 264 |
@app.route('/')
|
| 265 |
def hello():
|
requirements.txt
CHANGED
|
Binary files a/requirements.txt and b/requirements.txt differ
|
|
|