Skip to content

Commit

Permalink
clean model.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Freedisch authored Feb 12, 2024
1 parent 58cfc4e commit b423252
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions aimodel/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

app = Flask(__name__)
cap1 = cv2.VideoCapture(0)
# video = pafy.new("https://www.youtube.com/watch?v=Ic1f9wKjoJg")
# best = video.getbest(preftype="mp4")
# cap2 = cv2.VideoCapture(best.url)


def generate_frames(cap):
Expand All @@ -21,10 +18,9 @@ def generate_frames(cap):
while True:
success, img = cap.read()
img = cv2.resize(img, (1280, 550))
# img = cv2.imread("AiTrainer/test.jpg")
img = detector.findPose(img, False)
lmList = detector.findPosition(img, False)
# print(lmList)

if len(lmList) != 0:
# Right Arm
angle = detector.findAngle(img, 12, 24, 26)
Expand All @@ -34,7 +30,7 @@ def generate_frames(cap):
fall = True
else:
fall = False
# print(fall)
cTime = time.time()
fps = 1 / (cTime - pTime)
pTime = cTime
Expand All @@ -54,9 +50,6 @@ def index():
@app.route('/video1')
def video1():
return Response(generate_frames(cap1), mimetype='multipart/x-mixed-replace; boundary=frame')
# @app.route('/video2')
# def video2():
# return Response(generate_frames(cap2), mimetype='multipart/x-mixed-replace; boundary=frame')


if __name__ == '__main__':
Expand Down

0 comments on commit b423252

Please sign in to comment.