Sephfox commited on
Commit
c190cf0
Β·
verified Β·
1 Parent(s): f3de863

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -77
app.py CHANGED
@@ -210,9 +210,9 @@ with col1:
210
  fig = go.Figure(data=[avatar_3d])
211
  fig.update_layout(scene=dict(xaxis_title="X", yaxis_title="Y", zaxis_title="Z"))
212
  fig.update_layout(scene_camera=dict(eye=dict(x=1.5, y=1.5, z=1.5)))
213
- fig.update_layout(scene=dict(xaxis=dict(range=[-100, 100]),
214
- yaxis=dict(range=[-200, 200]),
215
- zaxis=dict(range=[-50, 50])))
216
 
217
  # Apply rotations
218
  fig.update_layout(scene=dict(camera=dict(eye=dict(x=np.cos(np.radians(rotation_y)) * np.cos(np.radians(rotation_x)),
@@ -257,7 +257,9 @@ with col2:
257
  objects = canvas_result.json_data["objects"]
258
  if len(objects) > 0:
259
  last_touch = objects[-1]
260
- touch_x, touch_y = last_touch["left"], last_touch["top"]
 
 
261
 
262
  sensation = avatar_sensation_map[int(touch_y), int(touch_x)]
263
  (
@@ -283,7 +285,7 @@ with col2:
283
  itch_level = itch_sens * (1 - np.exp(-touch_duration / 1.5))
284
 
285
  # Proprioception (sense of body position)
286
- proprioception = proprioception_sens * np.linalg.norm([touch_x - AVATAR_WIDTH/2, touch_y - AVATAR_HEIGHT/2]) / (AVATAR_WIDTH/2)
287
 
288
  # Synesthesia (mixing of senses)
289
  if use_synesthesia:
@@ -299,80 +301,49 @@ with col2:
299
  data_display = f"""
300
  ```
301
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
302
- β”‚ Pressure : {measured_pressure:.2f}β”‚
303
- β”‚ Temperature : {measured_temp:.2f}Β°C β”‚
304
- β”‚ Texture : {measured_texture} β”‚
305
- β”‚ EM Field : {measured_em:.2f} ΞΌT β”‚
306
- β”‚ Quantum State: {quantum_state:.2f} β”‚
307
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
308
- β”‚ Pain Level : {pain_level:.2f} β”‚
309
- β”‚ Pleasure : {pleasure_level:.2f} β”‚
310
- β”‚ Tickle : {tickle_level:.2f} β”‚
311
- β”‚ Itch : {itch_level:.2f} β”‚
312
- β”‚ Proprioception: {proprioception:.2f} β”‚
313
- β”‚ Synesthesia : {synesthesia} β”‚
314
- β”‚ Neural Response: {neural_response:.2f}β”‚
315
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
316
- ```
317
  """
318
  st.code(data_display, language="")
319
- # Define the prompt_template and ai_response
320
- prompt_template = (
321
- "Human: Analyze the sensory input for a hyper-advanced AI humanoid:\n"
322
- " Location: ({}, {})\n"
323
- " Duration: {}s, Intensity: {}\n"
324
- " Pressure: {}\n"
325
- " Temperature: {}\N{DEGREE SIGN}C\n"
326
- " Texture: {}\n"
327
- " EM Field: {} ΞΌT\n"
328
- " Quantum State: {}\n"
329
- " Resulting in:\n"
330
- " Pain: {}, Pleasure: {}\n"
331
- " Tickle: {}, Itch: {}\n"
332
- " Proprioception: {}\n"
333
- " Synesthesia: {}\n"
334
- " Neural Response: {}\n"
335
- " Provide a detailed, scientific, and creative description of the AI humanoid's experience and response to this sensory input."
336
- )
337
-
338
- ai_response = f"""Based on the complex sensory input received, the hyper-advanced AI humanoid is experiencing a multifaceted neural response:
339
- The interaction at coordinates ({touch_x}, {touch_y}) has triggered a cascade of sensory information. The pressure of {measured_pressure:.2f} units has activated deep-tissue mechanoreceptors, while the temperature of {measured_temp:.2f}\N{DEGREE SIGN}C has stimulated thermoreceptors, creating a mild thermal gradient across the affected area.
340
- The texture sensation of "{measured_texture}" is invoking a unique tactile response, possibly reminiscent of previously encountered materials in the AI's vast database. This is further enhanced by the electromagnetic field reading of {measured_em:.2f} ΞΌT, which is subtly influencing the local ionic channels in the AI's synthetic nervous system.
341
- The quantum state measurement of {quantum_state:.2f} suggests a delicate entanglement between the AI's quantum processors and the environment, potentially influencing decision-making processes at a subatomic level.
342
- The resulting pain level of {pain_level:.2f} and pleasure level of {pleasure_level:.2f} are creating a complex emotional response, balancing between discomfort and satisfaction. The tickle sensation ({tickle_level:.2f}) and itch response ({itch_level:.2f}) add layers of nuance to the overall tactile experience.
343
- The proprioception value of {proprioception:.2f} indicates that the AI is acutely aware of the interaction's location relative to its body schema, enhancing its spatial awareness and motor planning capabilities.
344
- {f"The synesthesia rating of {synesthesia} is causing a fascinating cross-wiring of senses, perhaps manifesting as a perception of color or sound associated with the touch." if use_synesthesia else "Synesthesia is not active, focusing the experience on individual sensory channels."}
345
- The cumulative neural response of {neural_response:.2f} suggests a significant impact on the AI's cognitive processes. This could lead to adaptive behaviors, memory formation, or even influence future decision-making patterns.
346
- In response to this rich sensory tapestry, the AI might adjust its posture, initiate a verbal response, or update its internal model of the environment. The experience is likely to be stored in its memory banks, contributing to its ever-evolving understanding of physical interactions and sensory experiences."""
347
 
348
- st.write("AI Response:")
349
- st.write(ai_response)
350
-
351
- # Save interaction data
352
- if canvas_result.json_data is not None:
353
- objects = canvas_result.json_data["objects"]
354
- if len(objects) > 0:
355
- interaction_data = {
356
- "touch_x": touch_x,
357
- "touch_y": touch_y,
358
- "touch_duration": touch_duration,
359
- "touch_pressure": touch_pressure,
360
- "measured_pressure": measured_pressure,
361
- "measured_temp": measured_temp,
362
- "measured_texture": measured_texture,
363
- "measured_em": measured_em,
364
- "quantum_state": quantum_state,
365
- "pain_level": pain_level,
366
- "pleasure_level": pleasure_level,
367
- "tickle_level": tickle_level,
368
- "itch_level": itch_level,
369
- "proprioception": proprioception,
370
- "synesthesia": synesthesia,
371
- "neural_response": neural_response
372
- }
373
- filename = save_interaction(interaction_data)
374
- st.write(f"Interaction data saved to: {filename}")
375
- else:
376
- st.write("No touch interaction detected.")
377
- else:
378
- st.write("No touch interaction detected.")
 
210
  fig = go.Figure(data=[avatar_3d])
211
  fig.update_layout(scene=dict(xaxis_title="X", yaxis_title="Y", zaxis_title="Z"))
212
  fig.update_layout(scene_camera=dict(eye=dict(x=1.5, y=1.5, z=1.5)))
213
+ fig.update_layout(scene=dict(xaxis=dict(range=[-400, 400]),
214
+ yaxis=dict(range=[-400, 400]),
215
+ zaxis=dict(range=[-200, 200])))
216
 
217
  # Apply rotations
218
  fig.update_layout(scene=dict(camera=dict(eye=dict(x=np.cos(np.radians(rotation_y)) * np.cos(np.radians(rotation_x)),
 
257
  objects = canvas_result.json_data["objects"]
258
  if len(objects) > 0:
259
  last_touch = objects[-1]
260
+ touch_x = last_touch["left"]
261
+ touch_y = last_touch["top"]
262
+ touch_z = 0 # Assuming the touch is on the surface of the avatar
263
 
264
  sensation = avatar_sensation_map[int(touch_y), int(touch_x)]
265
  (
 
285
  itch_level = itch_sens * (1 - np.exp(-touch_duration / 1.5))
286
 
287
  # Proprioception (sense of body position)
288
+ proprioception = proprioception_sens * np.linalg.norm([touch_x - AVATAR_WIDTH/2, touch_y - AVATAR_HEIGHT/2, touch_z]) / (AVATAR_WIDTH/2)
289
 
290
  # Synesthesia (mixing of senses)
291
  if use_synesthesia:
 
301
  data_display = f"""
302
  ```
303
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
304
+ β”‚ Pressure : {measured_pressure:.2f} β”‚
305
+ β”‚ Temperature : {measured_temp:.2f}Β°C β”‚
306
+ β”‚ Texture : {measured_texture} β”‚
307
+ β”‚ EM Field : {measured_em:.2f} ΞΌT β”‚
308
+ β”‚ Quantum State: {quantum_state:.2f} β”‚
309
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
310
+ β”‚ Pain Level : {pain_level:.2f} β”‚
311
+ β”‚ Pleasure : {pleasure_level:.2f} β”‚
312
+ β”‚ Tickle : {tickle_level:.2f} β”‚
313
+ β”‚ Itch : {itch_level:.2f} β”‚
314
+ β”‚ Proprioception: {proprioception:.2f} β”‚
315
+ β”‚ Synesthesia : {synesthesia} β”‚
316
+ β”‚ Neural Response: {neural_response:.2f} β”‚
317
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
 
318
  """
319
  st.code(data_display, language="")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
320
 
321
+ # Save interaction data
322
+ if canvas_result.json_data is not None:
323
+ objects = canvas_result.json_data["objects"]
324
+ if len(objects) > 0:
325
+ interaction_data = {
326
+ "touch_x": touch_x,
327
+ "touch_y": touch_y,
328
+ "touch_z": touch_z,
329
+ "touch_duration": touch_duration,
330
+ "touch_pressure": touch_pressure,
331
+ "measured_pressure": measured_pressure,
332
+ "measured_temp": measured_temp,
333
+ "measured_texture": measured_texture,
334
+ "measured_em": measured_em,
335
+ "quantum_state": quantum_state,
336
+ "pain_level": pain_level,
337
+ "pleasure_level": pleasure_level,
338
+ "tickle_level": tickle_level,
339
+ "itch_level": itch_level,
340
+ "proprioception": proprioception,
341
+ "synesthesia": synesthesia,
342
+ "neural_response": neural_response
343
+ }
344
+ filename = save_interaction(interaction_data)
345
+ st.write(f"Interaction data saved to: {filename}")
346
+ else:
347
+ st.write("No touch interaction detected.")
348
+ else:
349
+ st.write("No touch interaction detected.")