Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -578,13 +578,16 @@ def create_avatar():
|
|
578 |
|
579 |
return img
|
580 |
|
581 |
-
|
582 |
-
data = np.array(heatmap_img)
|
583 |
-
data[
|
584 |
-
|
|
|
|
|
585 |
|
586 |
-
combined_img = Image.alpha_composite(avatar_img.convert('RGBA'), heatmap_img)
|
587 |
-
return combined_img
|
|
|
588 |
|
589 |
# Create and display avatar with heatmap
|
590 |
st.subheader("Avatar with Sensation Heatmap")
|
|
|
578 |
|
579 |
return img
|
580 |
|
581 |
+
# Adjust alpha channel of heatmap
|
582 |
+
data = np.array(heatmap_img)
|
583 |
+
if data.shape[2] == 3: # If RGB, add an alpha channel
|
584 |
+
data = np.concatenate([data, np.full((data.shape[0], data.shape[1], 1), 255, dtype=np.uint8)], axis=2)
|
585 |
+
data[:, :, 3] = data[:, :, 3] * 0.5 # Reduce opacity to 50%
|
586 |
+
heatmap_img = Image.fromarray(data)
|
587 |
|
588 |
+
combined_img = Image.alpha_composite(avatar_img.convert('RGBA'), heatmap_img)
|
589 |
+
return combined_img
|
590 |
+
|
591 |
|
592 |
# Create and display avatar with heatmap
|
593 |
st.subheader("Avatar with Sensation Heatmap")
|