zlf18 commited on
Commit
af1f55d
·
verified ·
1 Parent(s): 631f3cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -47,7 +47,7 @@ class GestureRecognizer:
47
  return "**PEACE**", wrist_pos
48
 
49
  # 2. Check for "FIST"
50
- index_curled = landmarks[mp_hands.HandLandmark.INDEX_FINGER_TIP].y > landmarks[mp_hands.HandLandmark.INDEX_FINGER_PIP].y
51
  middle_curled = landmarks[mp_hands.HandLandmark.MIDDLE_FINGER_TIP].y > landmarks[mp_hands.HandLandmark.MIDDLE_FINGER_PIP].y
52
  ring_curled = landmarks[mp_hands.HandLandmark.RING_FINGER_TIP].y > landmarks[mp_hands.HandLandmark.RING_FINGER_PIP].y
53
 
@@ -135,8 +135,12 @@ def load_uploaded_model(temp_file):
135
 
136
  # --- 9. NEW: LOGIN FUNCTION ---
137
  def login_function(password):
138
- # --- SET YOUR PASSWORD HERE ---
139
- if password == "Its_zion_18":
 
 
 
 
140
  # Return updates to hide login and show app
141
  return gr.update(visible=False), gr.update(visible=True), gr.update(value="")
142
  else:
@@ -207,7 +211,7 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
207
  gr.Markdown(
208
  """
209
  <div style="width: 100%; text-align: center;">
210
- <b>Gesture Controls:</b> ✌️ <b>Peace Sign:</b> Reset/Home | 👌 <b>Pinch & Move:</b> Rotate | ✊ <b>Fist & Move Left/Right:</b> Zoom
211
  </div>
212
  """
213
  )
@@ -254,6 +258,5 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
254
  # ---
255
  # THIS IS THE LAUNCH COMMAND FOR HUGGING FACE
256
  # ---
257
- # We add share=True to fix the ValueError, but remove auth=
258
- # because the app now handles its own login.
259
  demo.launch(share=True)
 
47
  return "**PEACE**", wrist_pos
48
 
49
  # 2. Check for "FIST"
50
+ index_curled = landmarks[mp_hands.HandLandmark.INDEX_FINGER_TIP].y < landmarks[mp_hands.HandLandmark.INDEX_FINGER_PIP].y
51
  middle_curled = landmarks[mp_hands.HandLandmark.MIDDLE_FINGER_TIP].y > landmarks[mp_hands.HandLandmark.MIDDLE_FINGER_PIP].y
52
  ring_curled = landmarks[mp_hands.HandLandmark.RING_FINGER_TIP].y > landmarks[mp_hands.HandLandmark.RING_FINGER_PIP].y
53
 
 
135
 
136
  # --- 9. NEW: LOGIN FUNCTION ---
137
  def login_function(password):
138
+
139
+ # --- THIS IS THE FIX ---
140
+ # It now reads the SECURE password from the environment
141
+ correct_password = os.environ.get("APP_PASSWORD")
142
+
143
+ if password == correct_password:
144
  # Return updates to hide login and show app
145
  return gr.update(visible=False), gr.update(visible=True), gr.update(value="")
146
  else:
 
211
  gr.Markdown(
212
  """
213
  <div style="width: 100%; text-align: center;">
214
+ <b>Gesture Controls:</b> ✌️ <b>Peace Sign:</b> Reset/Home | 👌 <b>Pinch & Move:</b> Rotate | ✊ <b>Fist & Move Left/Right:</b> Zoom In / Zoom Out
215
  </div>
216
  """
217
  )
 
258
  # ---
259
  # THIS IS THE LAUNCH COMMAND FOR HUGGING FACE
260
  # ---
261
+ # We use share=True to fix the ValueError
 
262
  demo.launch(share=True)