arshtech commited on
Commit
0858bea
Β·
verified Β·
1 Parent(s): 7f8f006

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -27
app.py CHANGED
@@ -14,7 +14,7 @@ st.title("🀚 Hand2Voice")
14
  st.subheader("Hand Gestures to Speech Interface")
15
 
16
  # -------------------------------
17
- # Layout: Two Columns
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 Feed")
26
- camera_placeholder = st.empty()
27
 
28
  # -------------------------------
29
- # Text & Speech Section (Right)
30
  # -------------------------------
31
  with col2:
32
  st.markdown("### πŸ“ Recognized Text")
33
- text_placeholder = st.markdown(
34
- "<h2 style='color:#333;'>HELLO <span style='background-color:yellow;'>HOW</span> ARE YOU</h2>",
35
  unsafe_allow_html=True
36
  )
37
 
@@ -39,26 +39,7 @@ with col2:
39
  st.info("Currently speaking: HOW")
40
 
41
  # -------------------------------
42
- # Status Bar
43
  # -------------------------------
44
  st.markdown("---")
45
- st.success("Show your hand clearly in front of the camera")
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")