Sephfox commited on
Commit
7e589f2
1 Parent(s): 5c1a625

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +74 -74
app.py CHANGED
@@ -575,81 +575,81 @@ if uploaded_file is not None:
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
- # Calculate the average pressure value
629
- average_pressure = np.mean(sensation_map[:, :, 2])
630
-
631
- # Create a futuristic data display
632
- data_display = (
633
- "```\n"
634
- "+---------------------------------------------+\n"
635
- f"| Pressure : {average_pressure:.2f}".ljust(45) + "|\n"
636
- f"| Temperature : {np.mean(sensation_map[:, :, 3]):.2f}°C".ljust(45) + "|\n"
637
- f"| Texture : {np.mean(sensation_map[:, :, 4]):.2f}".ljust(45) + "|\n"
638
- f"| EM Field : {np.mean(sensation_map[:, :, 5]):.2f} μT".ljust(45) + "|\n"
639
- f"| Quantum State: {np.mean(sensation_map[:, :, 8]):.2f}".ljust(45) + "|\n"
640
- "+---------------------------------------------+\n"
641
- f"| Pain Level : {np.mean(sensation_map[:, :, 0]):.2f}".ljust(45) + "|\n"
642
- f"| Pleasure : {np.mean(sensation_map[:, :, 1]):.2f}".ljust(45) + "|\n"
643
- f"| Tickle : {np.mean(sensation_map[:, :, 6]):.2f}".ljust(45) + "|\n"
644
- f"| Itch : {np.mean(sensation_map[:, :, 7]):.2f}".ljust(45) + "|\n"
645
- f"| Proprioception: {np.mean(sensation_map[:, :, 10]):.2f}".ljust(44) + "|\n"
646
- f"| Synesthesia : {np.mean(sensation_map[:, :, 11]):.2f}".ljust(45) + "|\n"
647
- f"| Neural Response: {np.mean(sensation_map[:, :, 9]):.2f}".ljust(43) + "|\n"
648
- "+---------------------------------------------+\n"
649
- "```"
650
- )
651
 
652
- st.code(data_display, language="")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
653
 
654
  # Generate description
655
  prompt = (
 
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' in locals() and 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
+ # Calculate the average pressure value
629
+ average_pressure = np.mean(sensation_map[:, :, 2])
630
+
631
+ # Create a futuristic data display
632
+ data_display = (
633
+ "```\n"
634
+ "+---------------------------------------------+\n"
635
+ f"| Pressure : {average_pressure:.2f}".ljust(45) + "|\n"
636
+ f"| Temperature : {np.mean(sensation_map[:, :, 3]):.2f}°C".ljust(45) + "|\n"
637
+ f"| Texture : {np.mean(sensation_map[:, :, 4]):.2f}".ljust(45) + "|\n"
638
+ f"| EM Field : {np.mean(sensation_map[:, :, 5]):.2f} μT".ljust(45) + "|\n"
639
+ f"| Quantum State: {np.mean(sensation_map[:, :, 8]):.2f}".ljust(45) + "|\n"
640
+ "+---------------------------------------------+\n"
641
+ f"| Pain Level : {np.mean(sensation_map[:, :, 0]):.2f}".ljust(45) + "|\n"
642
+ f"| Pleasure : {np.mean(sensation_map[:, :, 1]):.2f}".ljust(45) + "|\n"
643
+ f"| Tickle : {np.mean(sensation_map[:, :, 6]):.2f}".ljust(45) + "|\n"
644
+ f"| Itch : {np.mean(sensation_map[:, :, 7]):.2f}".ljust(45) + "|\n"
645
+ f"| Proprioception: {np.mean(sensation_map[:, :, 10]):.2f}".ljust(44) + "|\n"
646
+ f"| Synesthesia : {np.mean(sensation_map[:, :, 11]):.2f}".ljust(45) + "|\n"
647
+ f"| Neural Response: {np.mean(sensation_map[:, :, 9]):.2f}".ljust(43) + "|\n"
648
+ "+---------------------------------------------+\n"
649
+ "```"
650
+ )
651
+
652
+ st.code(data_display, language="")
653
 
654
  # Generate description
655
  prompt = (