Spaces:
Runtime error
Runtime error
Shafeek Saleem
commited on
Commit
•
2e086e2
1
Parent(s):
0e1e0d9
bug fixed
Browse files
.idea/sonarlint/issuestore/2/6/261359fd9dbbe29d2e8fa924e82dca6f103aeb4b
DELETED
File without changes
|
.idea/sonarlint/issuestore/index.pb
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4b4951c46d564e515a40d50a2cdf6b46376c146df6a56092e672ecc1f965a7f2
|
3 |
+
size 123
|
0_Introduction.py
CHANGED
@@ -7,33 +7,47 @@ initialize_level()
|
|
7 |
|
8 |
LEVEL = 0
|
9 |
|
|
|
|
|
|
|
10 |
|
11 |
def intro_page():
|
12 |
-
st.
|
13 |
-
st.
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
)
|
25 |
-
|
26 |
-
st.write(
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
|
39 |
render_page(intro_page, LEVEL)
|
|
|
7 |
|
8 |
LEVEL = 0
|
9 |
|
10 |
+
import cv2
|
11 |
+
|
12 |
+
|
13 |
|
14 |
def intro_page():
|
15 |
+
st.title("Webcam Live Feed")
|
16 |
+
run = st.checkbox('Run')
|
17 |
+
FRAME_WINDOW = st.image([])
|
18 |
+
camera = cv2.VideoCapture(0)
|
19 |
+
|
20 |
+
while run:
|
21 |
+
_, frame = camera.read()
|
22 |
+
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
23 |
+
FRAME_WINDOW.image(frame)
|
24 |
+
else:
|
25 |
+
st.write('Stopped')
|
26 |
+
# st.header("Face Recognition")
|
27 |
+
# st.subheader("Introduction")
|
28 |
+
|
29 |
+
# st.write(
|
30 |
+
# """
|
31 |
+
# Welcome to the interactive tutorial on creating your very own Face Recognition Application!
|
32 |
+
# """
|
33 |
+
# )
|
34 |
+
#
|
35 |
+
# st.image(
|
36 |
+
# "https://static.wixstatic.com/media/abb909_35aa4b27e4b840659a20fd69f0a18354~mv2.gif",
|
37 |
+
# use_column_width=True,
|
38 |
+
# )
|
39 |
+
#
|
40 |
+
# st.write(
|
41 |
+
# """
|
42 |
+
# In this tutorial, you will learn how to build a simple application that can detect and recognise faces from a given photo. Face recognition has revolutionized
|
43 |
+
# various industries, including security, entertainment, and personal identification. Are you ready to dive into the exciting world of face recognition?
|
44 |
+
# """
|
45 |
+
# )
|
46 |
+
#
|
47 |
+
# st.info(f"Click on the button below to start the tutorial!")
|
48 |
+
#
|
49 |
+
# if st.button("I am Ready!"):
|
50 |
+
# complete_level(LEVEL)
|
51 |
|
52 |
|
53 |
render_page(intro_page, LEVEL)
|
pages/1_Technology Behind It.py
CHANGED
@@ -1,27 +1,12 @@
|
|
1 |
import streamlit as st
|
2 |
from utils.levels import complete_level, render_page, initialize_level
|
3 |
from utils.login import initialize_login
|
4 |
-
import cv2
|
5 |
|
6 |
LEVEL = 1
|
7 |
|
8 |
initialize_login()
|
9 |
initialize_level()
|
10 |
|
11 |
-
def returnCameraIndexes():
|
12 |
-
# checks the first 10 indexes.
|
13 |
-
index = 0
|
14 |
-
arr = []
|
15 |
-
i = 10
|
16 |
-
while i > 0:
|
17 |
-
cap = cv2.VideoCapture(index)
|
18 |
-
if cap.read()[0]:
|
19 |
-
arr.append(index)
|
20 |
-
cap.release()
|
21 |
-
index += 1
|
22 |
-
i -= 1
|
23 |
-
return arr
|
24 |
-
|
25 |
def step1_page():
|
26 |
st.header("Technology Behind It")
|
27 |
st.markdown(
|
@@ -60,29 +45,6 @@ def step1_page():
|
|
60 |
|
61 |
st.info("Click on the button below to continue!")
|
62 |
|
63 |
-
"""TEST"""
|
64 |
-
input_type = st.radio("Select the Input Type", ["Image upload", "Camera", "Live Video"])
|
65 |
-
st.write(returnCameraIndexes())
|
66 |
-
if input_type == "Live Video":
|
67 |
-
cam = cv2.VideoCapture(0)
|
68 |
-
if not cam.isOpened():
|
69 |
-
print("Cannot open camera")
|
70 |
-
exit()
|
71 |
-
cam.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
|
72 |
-
cam.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)
|
73 |
-
FRAME_WINDOW = st.image([])
|
74 |
-
|
75 |
-
while True:
|
76 |
-
ret, frame = cam.read()
|
77 |
-
if not ret:
|
78 |
-
st.error("Failed to capture frame from camera")
|
79 |
-
st.info("Please turn off the other app that is using the camera and restart app")
|
80 |
-
st.stop()
|
81 |
-
# image, name, face_id = recognize(frame, tolerance)
|
82 |
-
image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
83 |
-
# Display name and ID of the person
|
84 |
-
FRAME_WINDOW.image(image)
|
85 |
-
|
86 |
if st.button("Complete"):
|
87 |
complete_level(LEVEL)
|
88 |
|
|
|
1 |
import streamlit as st
|
2 |
from utils.levels import complete_level, render_page, initialize_level
|
3 |
from utils.login import initialize_login
|
|
|
4 |
|
5 |
LEVEL = 1
|
6 |
|
7 |
initialize_login()
|
8 |
initialize_level()
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
def step1_page():
|
11 |
st.header("Technology Behind It")
|
12 |
st.markdown(
|
|
|
45 |
|
46 |
st.info("Click on the button below to continue!")
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
if st.button("Complete"):
|
49 |
complete_level(LEVEL)
|
50 |
|