ovi054 commited on
Commit
cdbf891
·
verified ·
1 Parent(s): c51c462

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -20,10 +20,12 @@ def save_json(candidate, subset, json_file_path='./pose_data.json'):
20
  return json_file_path
21
 
22
  def pose_estimation(test_image):
23
- bgr_image_path = './test.png'
24
- with open(bgr_image_path, 'wb') as bgr_file:
25
- bgr_file.write(test_image)
26
- # Load the estimation models
 
 
27
  body_estimation = Body('model/body_pose_model.pth')
28
  hand_estimation = Hand('model/hand_pose_model.pth')
29
 
@@ -64,7 +66,8 @@ def convert_image_to_bytes(image_path):
64
  with gr.Blocks() as demo:
65
  gr.Markdown("# Pose Estimation")
66
  with gr.Row():
67
- image = gr.File(label="Upload Image", type="binary")
 
68
  output_image = gr.Image(label="Estimation Result")
69
  output_json = gr.File(label="Download Pose Data as JSON", type="filepath") # Add JSON output
70
  submit_button = gr.Button("Start Estimation")
 
20
  return json_file_path
21
 
22
  def pose_estimation(test_image):
23
+ oriImg = cv2.cvtColor(oriImg, cv2.COLOR_RGB2BGR)
24
+
25
+ # bgr_image_path = './test.png'
26
+ # with open(bgr_image_path, 'wb') as bgr_file:
27
+ # bgr_file.write(test_image)
28
+ # # Load the estimation models
29
  body_estimation = Body('model/body_pose_model.pth')
30
  hand_estimation = Hand('model/hand_pose_model.pth')
31
 
 
66
  with gr.Blocks() as demo:
67
  gr.Markdown("# Pose Estimation")
68
  with gr.Row():
69
+ # image = gr.File(label="Upload Image", type="binary")
70
+ image = gr.Image(label="Upload Image", type="numpy")
71
  output_image = gr.Image(label="Estimation Result")
72
  output_json = gr.File(label="Download Pose Data as JSON", type="filepath") # Add JSON output
73
  submit_button = gr.Button("Start Estimation")