Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -541,72 +541,68 @@ canvas_result = st_canvas(
|
|
541 |
)
|
542 |
|
543 |
|
544 |
-
# Touch controls and output
|
545 |
-
with col2:
|
546 |
-
st.subheader("Neural Interface Controls")
|
547 |
-
|
548 |
-
# Touch duration
|
549 |
-
touch_duration = st.slider("Interaction Duration (s)", 0.1, 5.0, 1.0, 0.1)
|
550 |
-
|
551 |
-
# Touch pressure
|
552 |
-
touch_pressure = st.slider("Interaction Intensity", 0.1, 2.0, 1.0, 0.1)
|
553 |
-
|
554 |
-
# Toggle quantum feature
|
555 |
-
use_quantum = st.checkbox("Enable Quantum Sensing", value=True)
|
556 |
-
|
557 |
-
# Toggle synesthesia
|
558 |
-
use_synesthesia = st.checkbox("Enable Synesthesia", value=False)
|
559 |
-
|
560 |
-
if canvas_result.json_data is not None:
|
561 |
-
objects = canvas_result.json_data["objects"]
|
562 |
-
if len(objects) > 0:
|
563 |
-
last_touch = objects[-1]
|
564 |
-
touch_x, touch_y = last_touch["left"], last_touch["top"]
|
565 |
-
|
566 |
-
sensation = avatar_sensation_map[int(touch_y), int(touch_x)]
|
567 |
-
(
|
568 |
-
pain, pleasure, pressure_sens, temp_sens, texture_sens,
|
569 |
-
em_sens, tickle_sens, itch_sens, quantum_sens, neural_sens,
|
570 |
-
proprioception_sens, synesthesia_sens
|
571 |
-
) = sensation
|
572 |
-
|
573 |
-
measured_pressure = QuantumSensor.measure(touch_x, touch_y, pressure_sens) * touch_pressure
|
574 |
-
measured_temp = NanoThermalSensor.measure(37, touch_pressure, touch_duration)
|
575 |
-
measured_texture = AdaptiveTextureSensor.measure(touch_x, touch_y)
|
576 |
-
measured_em = EMFieldSensor.measure(touch_x, touch_y, em_sens)
|
577 |
-
|
578 |
-
if use_quantum:
|
579 |
-
quantum_state = QuantumSensor.measure(touch_x, touch_y, quantum_sens)
|
580 |
-
else:
|
581 |
-
quantum_state = "N/A"
|
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 |
# Create a futuristic data display
|
612 |
data_display = (
|
|
|
541 |
)
|
542 |
|
543 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
544 |
|
545 |
+
# Touch controls and output
|
546 |
+
with col2:
|
547 |
+
st.subheader("Neural Interface Controls")
|
548 |
+
|
549 |
+
# Touch duration
|
550 |
+
touch_duration = st.slider("Interaction Duration (s)", 0.1, 5.0, 1.0, 0.1)
|
551 |
+
|
552 |
+
# Touch pressure
|
553 |
+
touch_pressure = st.slider("Interaction Intensity", 0.1, 2.0, 1.0, 0.1)
|
554 |
+
|
555 |
+
# Toggle quantum feature
|
556 |
+
use_quantum = st.checkbox("Enable Quantum Sensing", value=True)
|
557 |
+
|
558 |
+
# Toggle synesthesia
|
559 |
+
use_synesthesia = st.checkbox("Enable Synesthesia", value=False)
|
560 |
+
|
561 |
+
if canvas_result.json_data is not None:
|
562 |
+
objects = canvas_result.json_data["objects"]
|
563 |
+
if len(objects) > 0:
|
564 |
+
last_touch = objects[-1]
|
565 |
+
touch_x, touch_y = last_touch["left"], last_touch["top"]
|
566 |
+
|
567 |
+
sensation = avatar_sensation_map[int(touch_y), int(touch_x)]
|
568 |
+
(
|
569 |
+
pain, pleasure, pressure_sens, temp_sens, texture_sens,
|
570 |
+
em_sens, tickle_sens, itch_sens, quantum_sens, neural_sens,
|
571 |
+
proprioception_sens, synesthesia_sens
|
572 |
+
) = sensation
|
573 |
+
|
574 |
+
measured_pressure = QuantumSensor.measure(touch_x, touch_y, pressure_sens) * touch_pressure
|
575 |
+
measured_temp = NanoThermalSensor.measure(37, touch_pressure, touch_duration)
|
576 |
+
measured_texture = AdaptiveTextureSensor.measure(touch_x, touch_y)
|
577 |
+
measured_em = EMFieldSensor.measure(touch_x, touch_y, em_sens)
|
578 |
+
|
579 |
+
if use_quantum:
|
580 |
+
quantum_state = QuantumSensor.measure(touch_x, touch_y, quantum_sens)
|
581 |
+
else:
|
582 |
+
quantum_state = "N/A"
|
583 |
+
|
584 |
+
# Calculate overall sensations
|
585 |
+
pain_level = pain * measured_pressure * touch_pressure
|
586 |
+
pleasure_level = pleasure * (measured_temp - 37) / 10
|
587 |
+
tickle_level = tickle_sens * (1 - np.exp(-touch_duration / 0.5))
|
588 |
+
itch_level = itch_sens * (1 - np.exp(-touch_duration / 1.5))
|
589 |
+
|
590 |
+
# Proprioception (sense of body position)
|
591 |
+
proprioception = proprioception_sens * np.linalg.norm([touch_x - AVATAR_WIDTH/2, touch_y - AVATAR_HEIGHT/2]) / (AVATAR_WIDTH/2)
|
592 |
+
|
593 |
+
# Synesthesia (mixing of senses)
|
594 |
+
if use_synesthesia:
|
595 |
+
synesthesia = synesthesia_sens * (measured_pressure + measured_temp + measured_em) / 3
|
596 |
+
else:
|
597 |
+
synesthesia = "N/A"
|
598 |
+
|
599 |
+
# Neural network simulation
|
600 |
+
neural_inputs = [pain_level, pleasure_level, measured_pressure, measured_temp, measured_em, tickle_level, itch_level, proprioception]
|
601 |
+
neural_response = NeuralNetworkSimulator.process(neural_inputs)
|
602 |
+
|
603 |
+
st.write("### Sensory Data Analysis")
|
604 |
+
st.write(f"Interaction Point: ({touch_x:.1f}, {touch_y:.1f})")
|
605 |
+
st.write(f"Duration: {touch_duration:.1f} s | Intensity: {touch_pressure:.2f}")
|
606 |
|
607 |
# Create a futuristic data display
|
608 |
data_display = (
|