Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -468,12 +468,9 @@ def create_heatmap(sensation_map, sensation_type):
|
|
468 |
buf = io.BytesIO()
|
469 |
plt.savefig(buf, format='png')
|
470 |
buf.seek(0)
|
471 |
-
|
472 |
-
data = base64.b64encode(buf.getvalue()).decode('utf-8')
|
473 |
-
|
474 |
plt.close()
|
475 |
|
476 |
-
return
|
477 |
|
478 |
def generate_ai_response(keypoints, sensation_map):
|
479 |
num_keypoints = len(keypoints)
|
@@ -580,13 +577,6 @@ def create_avatar():
|
|
580 |
draw.line([start, end], fill=(0, 255, 255, 50), width=1)
|
581 |
|
582 |
return img
|
583 |
-
|
584 |
-
# Create avatar with heatmap function
|
585 |
-
def create_avatar_with_heatmap():
|
586 |
-
avatar_img = create_avatar()
|
587 |
-
heatmap_img = create_heatmap(avatar_sensation_map)
|
588 |
-
heatmap_img = heatmap_img.resize((AVATAR_WIDTH, AVATAR_HEIGHT))
|
589 |
-
heatmap_img = heatmap_img.convert('RGBA')
|
590 |
|
591 |
# Adjust alpha channel of heatmap
|
592 |
data = np.array(heatmap_img)
|
|
|
468 |
buf = io.BytesIO()
|
469 |
plt.savefig(buf, format='png')
|
470 |
buf.seek(0)
|
|
|
|
|
|
|
471 |
plt.close()
|
472 |
|
473 |
+
return Image.open(buf)
|
474 |
|
475 |
def generate_ai_response(keypoints, sensation_map):
|
476 |
num_keypoints = len(keypoints)
|
|
|
577 |
draw.line([start, end], fill=(0, 255, 255, 50), width=1)
|
578 |
|
579 |
return img
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
|
581 |
# Adjust alpha channel of heatmap
|
582 |
data = np.array(heatmap_img)
|