Sephfox commited on
Commit
59a8f26
1 Parent(s): 3d05c16

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -637,14 +637,25 @@ def create_avatar():
637
  draw.line([start, end], fill=(0, 255, 255, 50), width=1)
638
 
639
  return img
640
- # Adjust alpha channel of heatmap
 
 
 
 
 
 
 
 
 
 
641
  data = np.array(heatmap_img)
642
  if data.shape[2] == 3: # If RGB, add an alpha channel
643
  data = np.concatenate([data, np.full((data.shape[0], data.shape[1], 1), 255, dtype=np.uint8)], axis=2)
644
  data[:, :, 3] = data[:, :, 3] * 0.5 # Reduce opacity to 50%
645
  heatmap_img = Image.fromarray(data)
646
 
647
- combined_img = Image.alpha_composite(avatar_img.convert('RGBA'), heatmap_img)
 
648
  return combined_img
649
 
650
  # Streamlit app
@@ -652,7 +663,6 @@ st.title("NeuraSense AI: Advanced Humanoid Techno-Sensory Simulation")
652
 
653
 
654
 
655
- # Create two columns
656
 
657
  # Create three columns
658
  col1, col2, col3 = st.columns(3)
 
637
  draw.line([start, end], fill=(0, 255, 255, 50), width=1)
638
 
639
  return img
640
+ def create_avatar_with_heatmap(sensation_map, sensation_type):
641
+ # Create the base avatar
642
+ avatar_img = create_avatar()
643
+
644
+ # Create a heatmap
645
+ heatmap_img = create_heatmap(sensation_map, sensation_type)
646
+
647
+ # Resize heatmap to match avatar size
648
+ heatmap_img = heatmap_img.resize((AVATAR_WIDTH, AVATAR_HEIGHT))
649
+
650
+ # Adjust alpha channel of heatmap
651
  data = np.array(heatmap_img)
652
  if data.shape[2] == 3: # If RGB, add an alpha channel
653
  data = np.concatenate([data, np.full((data.shape[0], data.shape[1], 1), 255, dtype=np.uint8)], axis=2)
654
  data[:, :, 3] = data[:, :, 3] * 0.5 # Reduce opacity to 50%
655
  heatmap_img = Image.fromarray(data)
656
 
657
+ # Combine avatar and heatmap
658
+ combined_img = Image.alpha_composite(avatar_img.convert('RGBA'), heatmap_img.convert('RGBA'))
659
  return combined_img
660
 
661
  # Streamlit app
 
663
 
664
 
665
 
 
666
 
667
  # Create three columns
668
  col1, col2, col3 = st.columns(3)