Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -47,30 +47,15 @@ def process_hand(image):
|
|
47 |
st.title("AI Sign Language Interpreter")
|
48 |
st.write("Make a thumbs up or thumbs down gesture in front of your camera.")
|
49 |
|
50 |
-
#
|
51 |
-
uploaded_file = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
|
52 |
-
if uploaded_file is not None:
|
53 |
-
image = np.array(Image.open(uploaded_file))
|
54 |
-
processed_image = process_hand(image)
|
55 |
-
|
56 |
-
# Convert the image back to RGB for display
|
57 |
-
st.image(cv2.cvtColor(processed_image, cv2.COLOR_BGR2RGB), caption="Processed Output", use_column_width=True)
|
58 |
-
else:
|
59 |
-
st.write("Please upload an image.")
|
60 |
-
|
61 |
-
# Activate the webcam feed for live processing
|
62 |
if st.button("Start Webcam"):
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
st.write("Failed to capture image")
|
71 |
-
break
|
72 |
-
|
73 |
-
processed_frame = process_hand(frame)
|
74 |
-
stframe.image(cv2.cvtColor(processed_frame, cv2.COLOR_BGR2RGB), channels="RGB", use_column_width=True)
|
75 |
|
76 |
-
|
|
|
|
47 |
st.title("AI Sign Language Interpreter")
|
48 |
st.write("Make a thumbs up or thumbs down gesture in front of your camera.")
|
49 |
|
50 |
+
# Button to start webcam
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
if st.button("Start Webcam"):
|
52 |
+
# Use Streamlit's built-in camera input
|
53 |
+
video_input = st.camera_input("Camera Input")
|
54 |
+
|
55 |
+
if video_input is not None:
|
56 |
+
# Read the video input
|
57 |
+
image = Image.open(video_input)
|
58 |
+
processed_image = process_hand(np.array(image))
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
+
# Display the processed output
|
61 |
+
st.image(cv2.cvtColor(processed_image, cv2.COLOR_BGR2RGB), caption="Processed Output", use_column_width=True)
|