Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -336,9 +336,12 @@ custom_css = """
|
|
| 336 |
|
| 337 |
# Apply the custom CSS
|
| 338 |
st.markdown(custom_css, unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
|
| 340 |
-
# Constants
|
| 341 |
-
AVATAR_WIDTH, AVATAR_HEIGHT = 600, 800
|
| 342 |
# Create heatmap function
|
| 343 |
def create_heatmap(sensation_map):
|
| 344 |
overall_sensitivity = np.mean(sensation_map, axis=2)
|
|
@@ -350,18 +353,7 @@ def create_heatmap(sensation_map):
|
|
| 350 |
buf.seek(0)
|
| 351 |
heatmap_img = Image.open(buf)
|
| 352 |
plt.close(fig)
|
| 353 |
-
return heatmap_img
|
| 354 |
-
|
| 355 |
-
# Create avatar with heatmap function
|
| 356 |
-
def create_avatar_with_heatmap():
|
| 357 |
-
avatar_img = create_avatar()
|
| 358 |
-
heatmap_img = create_heatmap(avatar_sensation_map)
|
| 359 |
-
heatmap_img = heatmap_img.resize((AVATAR_WIDTH, AVATAR_HEIGHT))
|
| 360 |
-
combined_img = Image.alpha_composite(avatar_img.convert('RGBA'), heatmap_img.convert('RGBA'))
|
| 361 |
-
return combined_img
|
| 362 |
|
| 363 |
-
# Create the avatar with heatmap
|
| 364 |
-
avatar_with_heatmap = create_avatar_with_heatmap()
|
| 365 |
# Your Streamlit app code goes here
|
| 366 |
st.title("NeuraSense AI - Cyberpunk Edition")
|
| 367 |
|
|
@@ -512,6 +504,7 @@ def create_avatar():
|
|
| 512 |
draw.line([start, end], fill=(0, 255, 255, 50), width=1)
|
| 513 |
|
| 514 |
return img
|
|
|
|
| 515 |
# Create avatar with heatmap function
|
| 516 |
def create_avatar_with_heatmap():
|
| 517 |
avatar_img = create_avatar()
|
|
@@ -524,7 +517,6 @@ def create_avatar_with_heatmap():
|
|
| 524 |
avatar_with_heatmap = create_avatar_with_heatmap()
|
| 525 |
|
| 526 |
|
| 527 |
-
|
| 528 |
# Streamlit app
|
| 529 |
st.title("NeuraSense AI: Advanced Humanoid Techno-Sensory Simulation")
|
| 530 |
|
|
@@ -539,8 +531,8 @@ col1, col2 = st.columns([2, 1])
|
|
| 539 |
with col1:
|
| 540 |
st.subheader("Humanoid Avatar Interface")
|
| 541 |
|
| 542 |
-
|
| 543 |
-
canvas_result = st_canvas(
|
| 544 |
fill_color="rgba(0, 255, 255, 0.3)",
|
| 545 |
stroke_width=2,
|
| 546 |
stroke_color="#00FFFF",
|
|
|
|
| 336 |
|
| 337 |
# Apply the custom CSS
|
| 338 |
st.markdown(custom_css, unsafe_allow_html=True)
|
| 339 |
+
AVATAR_WIDTH = 600
|
| 340 |
+
AVATAR_HEIGHT = 800
|
| 341 |
+
|
| 342 |
+
# Create sensation map
|
| 343 |
+
avatar_sensation_map = create_sensation_map(AVATAR_WIDTH, AVATAR_HEIGHT)
|
| 344 |
|
|
|
|
|
|
|
| 345 |
# Create heatmap function
|
| 346 |
def create_heatmap(sensation_map):
|
| 347 |
overall_sensitivity = np.mean(sensation_map, axis=2)
|
|
|
|
| 353 |
buf.seek(0)
|
| 354 |
heatmap_img = Image.open(buf)
|
| 355 |
plt.close(fig)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 356 |
|
|
|
|
|
|
|
| 357 |
# Your Streamlit app code goes here
|
| 358 |
st.title("NeuraSense AI - Cyberpunk Edition")
|
| 359 |
|
|
|
|
| 504 |
draw.line([start, end], fill=(0, 255, 255, 50), width=1)
|
| 505 |
|
| 506 |
return img
|
| 507 |
+
|
| 508 |
# Create avatar with heatmap function
|
| 509 |
def create_avatar_with_heatmap():
|
| 510 |
avatar_img = create_avatar()
|
|
|
|
| 517 |
avatar_with_heatmap = create_avatar_with_heatmap()
|
| 518 |
|
| 519 |
|
|
|
|
| 520 |
# Streamlit app
|
| 521 |
st.title("NeuraSense AI: Advanced Humanoid Techno-Sensory Simulation")
|
| 522 |
|
|
|
|
| 531 |
with col1:
|
| 532 |
st.subheader("Humanoid Avatar Interface")
|
| 533 |
|
| 534 |
+
# Use st_canvas for touch input
|
| 535 |
+
canvas_result = st_canvas(
|
| 536 |
fill_color="rgba(0, 255, 255, 0.3)",
|
| 537 |
stroke_width=2,
|
| 538 |
stroke_color="#00FFFF",
|