Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -495,8 +495,6 @@ def generate_ai_response(keypoints, sensation_map):
|
|
495 |
|
496 |
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
497 |
|
498 |
-
# ... (rest of your code)
|
499 |
-
|
500 |
if uploaded_file is not None:
|
501 |
# Read the image
|
502 |
image_path = 'temp.jpg'
|
@@ -558,8 +556,7 @@ if uploaded_file is not None:
|
|
558 |
if st.button("Generate AI Response"):
|
559 |
response = generate_ai_response(keypoints, sensation_map)
|
560 |
st.write("AI Response:", response)
|
561 |
-
|
562 |
-
|
563 |
# Touch controls and output
|
564 |
st.subheader("Neural Interface Controls")
|
565 |
|
@@ -574,54 +571,59 @@ if uploaded_file is not None:
|
|
574 |
|
575 |
# Toggle synesthesia
|
576 |
use_synesthesia = st.checkbox("Enable Synesthesia", value=False)
|
|
|
577 |
# Add this with your other UI elements
|
578 |
show_heatmap = st.checkbox("Show Sensation Heatmap", value=True)
|
579 |
|
580 |
-
if
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
|
|
|
|
|
|
|
|
625 |
|
626 |
# Create a futuristic data display
|
627 |
data_display = (
|
|
|
495 |
|
496 |
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
497 |
|
|
|
|
|
498 |
if uploaded_file is not None:
|
499 |
# Read the image
|
500 |
image_path = 'temp.jpg'
|
|
|
556 |
if st.button("Generate AI Response"):
|
557 |
response = generate_ai_response(keypoints, sensation_map)
|
558 |
st.write("AI Response:", response)
|
559 |
+
|
|
|
560 |
# Touch controls and output
|
561 |
st.subheader("Neural Interface Controls")
|
562 |
|
|
|
571 |
|
572 |
# Toggle synesthesia
|
573 |
use_synesthesia = st.checkbox("Enable Synesthesia", value=False)
|
574 |
+
|
575 |
# Add this with your other UI elements
|
576 |
show_heatmap = st.checkbox("Show Sensation Heatmap", value=True)
|
577 |
|
578 |
+
if st.button("Simulate Interaction"):
|
579 |
+
# Simulate interaction at the clicked point
|
580 |
+
if clicked_points:
|
581 |
+
touch_x, touch_y = clicked_points[-1]
|
582 |
+
|
583 |
+
sensation = sensation_map[touch_y, touch_x]
|
584 |
+
(
|
585 |
+
pain, pleasure, pressure_sens, temp_sens, texture_sens,
|
586 |
+
em_sens, tickle_sens, itch_sens, quantum_sens, neural_sens,
|
587 |
+
proprioception_sens, synesthesia_sens
|
588 |
+
) = sensation
|
589 |
+
|
590 |
+
measured_pressure = pressure_sens * touch_pressure
|
591 |
+
measured_temp = temp_sens # Assuming temperature doesn't change
|
592 |
+
measured_texture = texture_sens # Assuming texture doesn't change
|
593 |
+
measured_em = em_sens # Assuming EM field doesn't change
|
594 |
+
|
595 |
+
if use_quantum:
|
596 |
+
quantum_state = quantum_sens
|
597 |
+
else:
|
598 |
+
quantum_state = "N/A"
|
599 |
+
|
600 |
+
# Calculate overall sensations
|
601 |
+
pain_level = pain * measured_pressure * touch_pressure
|
602 |
+
pleasure_level = pleasure * (measured_temp - 37) / 10
|
603 |
+
tickle_level = tickle_sens * (1 - np.exp(-touch_duration / 0.5))
|
604 |
+
itch_level = itch_sens * (1 - np.exp(-touch_duration / 1.5))
|
605 |
+
|
606 |
+
# Proprioception (sense of body position)
|
607 |
+
proprioception = proprioception_sens * np.linalg.norm([touch_x - image_width/2, touch_y - image_height/2]) / (image_width/2)
|
608 |
+
|
609 |
+
# Synesthesia (mixing of senses)
|
610 |
+
if use_synesthesia:
|
611 |
+
synesthesia = synesthesia_sens * (measured_pressure + measured_temp + measured_em) / 3
|
612 |
+
else:
|
613 |
+
synesthesia = "N/A"
|
614 |
+
|
615 |
+
st.write("### Simulated Interaction Results")
|
616 |
+
st.write(f"Interaction Point: ({touch_x:.1f}, {touch_y:.1f})")
|
617 |
+
st.write(f"Duration: {touch_duration:.1f} s | Intensity: {touch_pressure:.2f}")
|
618 |
+
st.write(f"Pain: {pain_level:.2f} | Pleasure: {pleasure_level:.2f} | Pressure: {measured_pressure:.2f}")
|
619 |
+
st.write(f"Temperature: {measured_temp:.2f} | Texture: {measured_texture:.2f} | EM Field: {measured_em:.2f}")
|
620 |
+
st.write(f"Tickle: {tickle_level:.2f} | Itch: {itch_level:.2f} | Quantum: {quantum_state}")
|
621 |
+
st.write(f"Neural: {neural_sens:.2f} | Proprioception: {proprioception:.2f} | Synesthesia: {synesthesia}")
|
622 |
+
|
623 |
+
# Display a heatmap of the sensations
|
624 |
+
if show_heatmap:
|
625 |
+
heatmap = create_heatmap(sensation_map, sensation_types.index("Pain"))
|
626 |
+
st.image(heatmap, use_column_width=True)
|
627 |
|
628 |
# Create a futuristic data display
|
629 |
data_display = (
|