Sephfox commited on
Commit
4a9b087
·
verified ·
1 Parent(s): 8e8230f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -2
app.py CHANGED
@@ -362,7 +362,18 @@ exploration_type = st.selectbox("Choose a sensory exploration:",
362
  if exploration_type == "Quantum Field Fluctuations":
363
  st.write("Observe how quantum fields fluctuate across the AI's body.")
364
  quantum_field = np.array([[QuantumSensor.measure(x, y, 1) for x in range(AVATAR_WIDTH)] for y in range(AVATAR_HEIGHT)])
365
- st.image(plt.imshow(quantum_field, cmap='viridis'), use_column_width=True)
 
 
 
 
 
 
 
 
 
 
 
366
 
367
  elif exploration_type == "Synesthesia Experience":
368
  st.write("Experience how the AI might perceive colors as sounds or textures as tastes.")
@@ -373,7 +384,18 @@ elif exploration_type == "Proprioceptive Mapping":
373
  st.write("Explore the AI's sense of body position and movement.")
374
  proprioceptive_map = np.array([[np.linalg.norm([x - AVATAR_WIDTH/2, y - AVATAR_HEIGHT/2]) / (AVATAR_WIDTH/2)
375
  for x in range(AVATAR_WIDTH)] for y in range(AVATAR_HEIGHT)])
376
- st.image(plt.imshow(proprioceptive_map, cmap='coolwarm'), use_column_width=True)
 
 
 
 
 
 
 
 
 
 
 
377
  # Footer
378
  st.write("---")
379
  st.write("NeuraSense AI: Quantum-Enhanced Sensory Simulation v4.0")
 
362
  if exploration_type == "Quantum Field Fluctuations":
363
  st.write("Observe how quantum fields fluctuate across the AI's body.")
364
  quantum_field = np.array([[QuantumSensor.measure(x, y, 1) for x in range(AVATAR_WIDTH)] for y in range(AVATAR_HEIGHT)])
365
+
366
+ # Save the plot to an in-memory buffer
367
+ buf = io.BytesIO()
368
+ plt.figure(figsize=(8, 6))
369
+ plt.imshow(quantum_field, cmap='viridis')
370
+ plt.savefig(buf, format='png')
371
+
372
+ # Create a PIL Image object from the buffer
373
+ quantum_image = Image.open(buf)
374
+
375
+ # Display the image using st.image()
376
+ st.image(quantum_image, use_column_width=True)
377
 
378
  elif exploration_type == "Synesthesia Experience":
379
  st.write("Experience how the AI might perceive colors as sounds or textures as tastes.")
 
384
  st.write("Explore the AI's sense of body position and movement.")
385
  proprioceptive_map = np.array([[np.linalg.norm([x - AVATAR_WIDTH/2, y - AVATAR_HEIGHT/2]) / (AVATAR_WIDTH/2)
386
  for x in range(AVATAR_WIDTH)] for y in range(AVATAR_HEIGHT)])
387
+
388
+ # Save the plot to an in-memory buffer
389
+ buf = io.BytesIO()
390
+ plt.figure(figsize=(8, 6))
391
+ plt.imshow(proprioceptive_map, cmap='coolwarm')
392
+ plt.savefig(buf, format='png')
393
+
394
+ # Create a PIL Image object from the buffer
395
+ proprioceptive_image = Image.open(buf)
396
+
397
+ # Display the image using st.image()
398
+ st.image(proprioceptive_image, use_column_width=True)
399
  # Footer
400
  st.write("---")
401
  st.write("NeuraSense AI: Quantum-Enhanced Sensory Simulation v4.0")