Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -487,8 +487,8 @@ def plot_human_pose(keypoints):
|
|
| 487 |
|
| 488 |
# Close the plot to release resources
|
| 489 |
plt.close()
|
| 490 |
-
|
| 491 |
-
return
|
| 492 |
|
| 493 |
# Example usage:
|
| 494 |
# keypoints = test_predict_plot.detach().numpy() # Replace with your 33 key points
|
|
@@ -518,12 +518,17 @@ def predict_pose(image):
|
|
| 518 |
|
| 519 |
pred_keypoints = outputs.reshape(1,33,4)[0]
|
| 520 |
pred_keypoints = pred_keypoints.detach().numpy()
|
| 521 |
-
|
| 522 |
return plot_human_pose(pred_keypoints)
|
| 523 |
|
| 524 |
# predict_pose(test_image)
|
| 525 |
-
|
| 526 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 527 |
|
| 528 |
pose_detector.launch()
|
| 529 |
|
|
|
|
| 487 |
|
| 488 |
# Close the plot to release resources
|
| 489 |
plt.close()
|
| 490 |
+
out = Image.open(buffer)
|
| 491 |
+
return out
|
| 492 |
|
| 493 |
# Example usage:
|
| 494 |
# keypoints = test_predict_plot.detach().numpy() # Replace with your 33 key points
|
|
|
|
| 518 |
|
| 519 |
pred_keypoints = outputs.reshape(1,33,4)[0]
|
| 520 |
pred_keypoints = pred_keypoints.detach().numpy()
|
|
|
|
| 521 |
return plot_human_pose(pred_keypoints)
|
| 522 |
|
| 523 |
# predict_pose(test_image)
|
| 524 |
+
input_image = [
|
| 525 |
+
gr.Components.Image(type = 'pil'),
|
| 526 |
+
]
|
| 527 |
+
|
| 528 |
+
output_image = [
|
| 529 |
+
gr.Components.Image(type = 'pil'),
|
| 530 |
+
]
|
| 531 |
+
pose_detector = gr.Interface(fn = predict_pose, inputs = input_image , outputs = output_image )
|
| 532 |
|
| 533 |
pose_detector.launch()
|
| 534 |
|