JefferyJapheth commited on
Commit
4d98c67
1 Parent(s): 4ca0f67
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import cv2
2
  import gradio as gr
3
  import mediapipe as mp
@@ -13,11 +14,15 @@ hands = mp_hands.Hands()
13
  pose = mp_pose.Pose()
14
  face_mesh = mp_face_mesh.FaceMesh()
15
 
16
- # Load the TFLite model
17
- interpreter = tflite.Interpreter(model_path="model.tflite")
 
 
 
 
 
 
18
  interpreter.allocate_tensors()
19
- input_details = interpreter.get_input_details()
20
- output_details = interpreter.get_output_details()
21
 
22
  # Preprocess landmarks
23
  def preprocess_landmarks(hand1_landmarks, hand2_landmarks, pose_landmarks, lip_landmarks):
 
1
+ import os
2
  import cv2
3
  import gradio as gr
4
  import mediapipe as mp
 
14
  pose = mp_pose.Pose()
15
  face_mesh = mp_face_mesh.FaceMesh()
16
 
17
+ # Get the absolute path to the directory containing app.py
18
+ current_dir = os.path.dirname(os.path.abspath(__file__))
19
+ # Define the filename of the TFLite model
20
+ model_filename = "model.tflite"
21
+ # Construct the full path to the TFLite model file
22
+ model_path = os.path.join(current_dir, model_filename)
23
+ # Load the TFLite model using the interpreter
24
+ interpreter = tf.lite.Interpreter(model_path=model_path)
25
  interpreter.allocate_tensors()
 
 
26
 
27
  # Preprocess landmarks
28
  def preprocess_landmarks(hand1_landmarks, hand2_landmarks, pose_landmarks, lip_landmarks):