Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +14,7 @@ st.title("π€ Hand2Voice")
|
|
| 14 |
st.subheader("Hand Gestures to Speech Interface")
|
| 15 |
|
| 16 |
# -------------------------------
|
| 17 |
-
# Layout
|
| 18 |
# -------------------------------
|
| 19 |
col1, col2 = st.columns(2)
|
| 20 |
|
|
@@ -22,16 +22,16 @@ col1, col2 = st.columns(2)
|
|
| 22 |
# Camera Section (Left)
|
| 23 |
# -------------------------------
|
| 24 |
with col1:
|
| 25 |
-
st.markdown("### π· Camera
|
| 26 |
-
|
| 27 |
|
| 28 |
# -------------------------------
|
| 29 |
-
# Text
|
| 30 |
# -------------------------------
|
| 31 |
with col2:
|
| 32 |
st.markdown("### π Recognized Text")
|
| 33 |
-
|
| 34 |
-
"<h2
|
| 35 |
unsafe_allow_html=True
|
| 36 |
)
|
| 37 |
|
|
@@ -39,26 +39,7 @@ with col2:
|
|
| 39 |
st.info("Currently speaking: HOW")
|
| 40 |
|
| 41 |
# -------------------------------
|
| 42 |
-
# Status
|
| 43 |
# -------------------------------
|
| 44 |
st.markdown("---")
|
| 45 |
-
st.success("
|
| 46 |
-
|
| 47 |
-
# -------------------------------
|
| 48 |
-
# OpenCV Camera Loop
|
| 49 |
-
# -------------------------------
|
| 50 |
-
cap = cv2.VideoCapture(0)
|
| 51 |
-
|
| 52 |
-
while cap.isOpened():
|
| 53 |
-
ret, frame = cap.read()
|
| 54 |
-
if not ret:
|
| 55 |
-
st.error("Camera not accessible")
|
| 56 |
-
break
|
| 57 |
-
|
| 58 |
-
# Convert BGR to RGB for Streamlit
|
| 59 |
-
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
| 60 |
-
|
| 61 |
-
# Display frame
|
| 62 |
-
camera_placeholder.image(frame, channels="RGB")
|
| 63 |
-
|
| 64 |
-
cap.release()
|
|
|
|
| 14 |
st.subheader("Hand Gestures to Speech Interface")
|
| 15 |
|
| 16 |
# -------------------------------
|
| 17 |
+
# Layout
|
| 18 |
# -------------------------------
|
| 19 |
col1, col2 = st.columns(2)
|
| 20 |
|
|
|
|
| 22 |
# Camera Section (Left)
|
| 23 |
# -------------------------------
|
| 24 |
with col1:
|
| 25 |
+
st.markdown("### π· Camera Input")
|
| 26 |
+
image = st.camera_input("Capture hand gesture")
|
| 27 |
|
| 28 |
# -------------------------------
|
| 29 |
+
# Text Section (Right)
|
| 30 |
# -------------------------------
|
| 31 |
with col2:
|
| 32 |
st.markdown("### π Recognized Text")
|
| 33 |
+
st.markdown(
|
| 34 |
+
"<h2>HELLO <span style='background-color:yellow;'>HOW</span> ARE YOU</h2>",
|
| 35 |
unsafe_allow_html=True
|
| 36 |
)
|
| 37 |
|
|
|
|
| 39 |
st.info("Currently speaking: HOW")
|
| 40 |
|
| 41 |
# -------------------------------
|
| 42 |
+
# Status
|
| 43 |
# -------------------------------
|
| 44 |
st.markdown("---")
|
| 45 |
+
st.success("Capture an image of your hand to begin")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|