Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -11,8 +11,11 @@ from io import BytesIO
|
|
11 |
import base64
|
12 |
from streamlit_drawable_canvas import st_canvas
|
13 |
import io
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
16 |
|
17 |
|
18 |
# Set page config
|
@@ -456,18 +459,18 @@ def create_sensation_map(width, height, keypoints):
|
|
456 |
def create_heatmap(sensation_map, sensation_type):
|
457 |
plt.figure(figsize=(10, 15))
|
458 |
sns.heatmap(sensation_map[:, :, sensation_type], cmap='viridis')
|
459 |
-
|
460 |
-
|
461 |
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
|
466 |
-
|
467 |
|
468 |
-
|
469 |
|
470 |
-
|
471 |
|
472 |
# Streamlit app
|
473 |
st.title("NeuraSense AI - Humanoid Touch Point Detection")
|
|
|
11 |
import base64
|
12 |
from streamlit_drawable_canvas import st_canvas
|
13 |
import io
|
14 |
+
import torch
|
15 |
+
from torchvision import transforms
|
16 |
+
import cv2
|
17 |
+
import mediapipe as mp
|
18 |
+
import base64
|
19 |
|
20 |
|
21 |
# Set page config
|
|
|
459 |
def create_heatmap(sensation_map, sensation_type):
|
460 |
plt.figure(figsize=(10, 15))
|
461 |
sns.heatmap(sensation_map[:, :, sensation_type], cmap='viridis')
|
462 |
+
plt.title(f'{["Pain", "Pleasure", "Pressure", "Temperature", "Texture", "EM Field", "Tickle", "Itch", "Quantum", "Neural", "Proprioception", "Synesthesia"][sensation_type]} Sensation Map')
|
463 |
+
plt.axis('off')
|
464 |
|
465 |
+
buf = io.BytesIO()
|
466 |
+
plt.savefig(buf, format='png')
|
467 |
+
buf.seek(0)
|
468 |
|
469 |
+
data = base64.b64encode(buf.getvalue()).decode('utf-8')
|
470 |
|
471 |
+
plt.close()
|
472 |
|
473 |
+
return f'data:image/png;base64,{data}'
|
474 |
|
475 |
# Streamlit app
|
476 |
st.title("NeuraSense AI - Humanoid Touch Point Detection")
|