Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -341,28 +341,6 @@ AVATAR_HEIGHT = 800
|
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
-
def create_heatmap(sensation_map):
|
| 345 |
-
# Calculate the overall sensitivity by taking the mean across all sensations
|
| 346 |
-
overall_sensitivity = np.mean(sensation_map, axis=2)
|
| 347 |
-
|
| 348 |
-
# Create a figure and axis
|
| 349 |
-
fig, ax = plt.subplots(figsize=(10, 15))
|
| 350 |
-
|
| 351 |
-
# Generate the heatmap
|
| 352 |
-
sns.heatmap(overall_sensitivity, cmap='YlOrRd', alpha=0.7, cbar=False, ax=ax)
|
| 353 |
-
|
| 354 |
-
# Remove axes and labels
|
| 355 |
-
ax.set_axis_off()
|
| 356 |
-
|
| 357 |
-
# Convert the plot to an image
|
| 358 |
-
buf = BytesIO()
|
| 359 |
-
plt.savefig(buf, format='png', bbox_inches='tight', pad_inches=0)
|
| 360 |
-
buf.seek(0)
|
| 361 |
-
heatmap_img = Image.open(buf)
|
| 362 |
-
|
| 363 |
-
plt.close(fig)
|
| 364 |
-
|
| 365 |
-
return heatmap_img
|
| 366 |
# Your Streamlit app code goes here
|
| 367 |
st.title("NeuraSense AI - Cyberpunk Edition")
|
| 368 |
|
|
@@ -457,6 +435,29 @@ def create_sensation_map(width, height):
|
|
| 457 |
|
| 458 |
avatar_sensation_map = create_sensation_map(AVATAR_WIDTH, AVATAR_HEIGHT)
|
| 459 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 460 |
|
| 461 |
|
| 462 |
# Create futuristic human-like avatar
|
|
@@ -532,6 +533,60 @@ def create_avatar_with_heatmap():
|
|
| 532 |
# Create the avatar with heatmap
|
| 533 |
avatar_with_heatmap = create_avatar_with_heatmap()
|
| 534 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 535 |
|
| 536 |
# Streamlit app
|
| 537 |
st.title("NeuraSense AI: Advanced Humanoid Techno-Sensory Simulation")
|
|
@@ -539,7 +594,9 @@ st.title("NeuraSense AI: Advanced Humanoid Techno-Sensory Simulation")
|
|
| 539 |
|
| 540 |
|
| 541 |
# Create two columns
|
| 542 |
-
|
|
|
|
|
|
|
| 543 |
|
| 544 |
|
| 545 |
|
|
@@ -560,7 +617,10 @@ canvas_result = st_canvas(
|
|
| 560 |
)
|
| 561 |
|
| 562 |
|
| 563 |
-
|
|
|
|
|
|
|
|
|
|
| 564 |
# Touch controls and output
|
| 565 |
with col2:
|
| 566 |
st.subheader("Neural Interface Controls")
|
|
|
|
| 341 |
|
| 342 |
|
| 343 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
# Your Streamlit app code goes here
|
| 345 |
st.title("NeuraSense AI - Cyberpunk Edition")
|
| 346 |
|
|
|
|
| 435 |
|
| 436 |
avatar_sensation_map = create_sensation_map(AVATAR_WIDTH, AVATAR_HEIGHT)
|
| 437 |
|
| 438 |
+
# Create heatmap function
|
| 439 |
+
def create_heatmap(sensation_map):
|
| 440 |
+
# Calculate the overall sensitivity by taking the mean across all sensations
|
| 441 |
+
overall_sensitivity = np.mean(sensation_map, axis=2)
|
| 442 |
+
|
| 443 |
+
# Create a figure and axis
|
| 444 |
+
fig, ax = plt.subplots(figsize=(10, 15))
|
| 445 |
+
|
| 446 |
+
# Generate the heatmap
|
| 447 |
+
sns.heatmap(overall_sensitivity, cmap='YlOrRd', alpha=0.7, cbar=False, ax=ax)
|
| 448 |
+
|
| 449 |
+
# Remove axes and labels
|
| 450 |
+
ax.set_axis_off()
|
| 451 |
+
|
| 452 |
+
# Convert the plot to an image
|
| 453 |
+
buf = BytesIO()
|
| 454 |
+
plt.savefig(buf, format='png', bbox_inches='tight', pad_inches=0)
|
| 455 |
+
buf.seek(0)
|
| 456 |
+
heatmap_img = Image.open(buf)
|
| 457 |
+
|
| 458 |
+
plt.close(fig)
|
| 459 |
+
|
| 460 |
+
return heatmap_img
|
| 461 |
|
| 462 |
|
| 463 |
# Create futuristic human-like avatar
|
|
|
|
| 533 |
# Create the avatar with heatmap
|
| 534 |
avatar_with_heatmap = create_avatar_with_heatmap()
|
| 535 |
|
| 536 |
+
# Create avatar function
|
| 537 |
+
def create_avatar():
|
| 538 |
+
img = Image.new('RGBA', (AVATAR_WIDTH, AVATAR_HEIGHT), color=(0, 0, 0, 0))
|
| 539 |
+
draw = ImageDraw.Draw(img)
|
| 540 |
+
|
| 541 |
+
# Body
|
| 542 |
+
draw.polygon([(300, 100), (200, 250), (250, 600), (300, 750), (350, 600), (400, 250)], fill=(0, 255, 255, 100), outline=(0, 255, 255, 255))
|
| 543 |
+
|
| 544 |
+
# Head
|
| 545 |
+
draw.ellipse([250, 50, 350, 150], fill=(0, 255, 255, 100), outline=(0, 255, 255, 255))
|
| 546 |
+
|
| 547 |
+
# Eyes
|
| 548 |
+
draw.ellipse([275, 80, 295, 100], fill=(255, 255, 255, 200), outline=(0, 255, 255, 255))
|
| 549 |
+
draw.ellipse([305, 80, 325, 100], fill=(255, 255, 255, 200), outline=(0, 255, 255, 255))
|
| 550 |
+
|
| 551 |
+
# Nose
|
| 552 |
+
draw.polygon([(300, 90), (290, 110), (310, 110)], fill=(0, 255, 255, 150))
|
| 553 |
+
|
| 554 |
+
# Mouth
|
| 555 |
+
draw.arc([280, 110, 320, 130], 0, 180, fill=(0, 255, 255, 200), width=2)
|
| 556 |
+
|
| 557 |
+
# Arms
|
| 558 |
+
draw.line([(200, 250), (150, 400)], fill=(0, 255, 255, 200), width=5)
|
| 559 |
+
draw.line([(400, 250), (450, 400)], fill=(0, 255, 255, 200), width=5)
|
| 560 |
+
|
| 561 |
+
# Hands
|
| 562 |
+
draw.ellipse([140, 390, 160, 410], fill=(0, 255, 255, 150))
|
| 563 |
+
draw.ellipse([440, 390, 460, 410], fill=(0, 255, 255, 150))
|
| 564 |
+
|
| 565 |
+
# Fingers
|
| 566 |
+
for i in range(5):
|
| 567 |
+
draw.line([(150 + i*5, 400), (145 + i*5, 420)], fill=(0, 255, 255, 200), width=2)
|
| 568 |
+
draw.line([(450 - i*5, 400), (455 - i*5, 420)], fill=(0, 255, 255, 200), width=2)
|
| 569 |
+
|
| 570 |
+
# Legs
|
| 571 |
+
draw.line([(250, 600), (230, 780)], fill=(0, 255, 255, 200), width=5)
|
| 572 |
+
draw.line([(350, 600), (370, 780)], fill=(0, 255, 255, 200), width=5)
|
| 573 |
+
|
| 574 |
+
# Feet
|
| 575 |
+
draw.ellipse([220, 770, 240, 790], fill=(0, 255, 255, 150))
|
| 576 |
+
draw.ellipse([360, 770, 380, 790], fill=(0, 255, 255, 150))
|
| 577 |
+
|
| 578 |
+
# Toes
|
| 579 |
+
for i in range(5):
|
| 580 |
+
draw.line([(225 + i*3, 790), (223 + i*3, 800)], fill=(0, 255, 255, 200), width=2)
|
| 581 |
+
draw.line([(365 + i*3, 790), (363 + i*3, 800)], fill=(0, 255, 255, 200), width=2)
|
| 582 |
+
|
| 583 |
+
# Neural network lines
|
| 584 |
+
for _ in range(100):
|
| 585 |
+
start = (np.random.randint(0, AVATAR_WIDTH), np.random.randint(0, AVATAR_HEIGHT))
|
| 586 |
+
end = (np.random.randint(0, AVATAR_WIDTH), np.random.randint(0, AVATAR_HEIGHT))
|
| 587 |
+
draw.line([start, end], fill=(0, 255, 255, 50), width=1)
|
| 588 |
+
|
| 589 |
+
return img
|
| 590 |
|
| 591 |
# Streamlit app
|
| 592 |
st.title("NeuraSense AI: Advanced Humanoid Techno-Sensory Simulation")
|
|
|
|
| 594 |
|
| 595 |
|
| 596 |
# Create two columns
|
| 597 |
+
|
| 598 |
+
# Create three columns
|
| 599 |
+
col1, col2, col3 = st.columns(3)
|
| 600 |
|
| 601 |
|
| 602 |
|
|
|
|
| 617 |
)
|
| 618 |
|
| 619 |
|
| 620 |
+
with col3:
|
| 621 |
+
st.subheader("Sensation Heatmap")
|
| 622 |
+
heatmap = create_heatmap(avatar_sensation_map)
|
| 623 |
+
st.image(heatmap, use_column_width=True)
|
| 624 |
# Touch controls and output
|
| 625 |
with col2:
|
| 626 |
st.subheader("Neural Interface Controls")
|