Sephfox commited on
Commit
8cb6cb7
Β·
verified Β·
1 Parent(s): a8e82e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +91 -94
app.py CHANGED
@@ -122,14 +122,33 @@ def create_sensation_map(width, height):
122
 
123
  avatar_sensation_map = create_sensation_map(AVATAR_WIDTH, AVATAR_HEIGHT)
124
 
125
- # Create 3D avatar
126
  def create_3d_avatar():
127
- x = np.array([0, 0, 1, 1, 0, 0, 1, 1])
128
- y = np.array([0, 1, 1, 0, 0, 1, 1, 0])
129
- z = np.array([0, 0, 0, 0, 1, 1, 1, 1])
130
- x = (x - 0.5) * 100
131
- y = (y - 0.5) * 200
132
- z = (z - 0.5) * 50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  return go.Mesh3d(x=x, y=y, z=z, color='cyan', opacity=0.5)
134
 
135
  # Enhanced Autonomy Class
@@ -276,103 +295,81 @@ with col2:
276
  neural_inputs = [pain_level, pleasure_level, measured_pressure, measured_temp, measured_em, tickle_level, itch_level, proprioception]
277
  neural_response = NeuralNetworkSimulator.process(neural_inputs)
278
 
279
- st.write("### Sensory Data Analysis")
280
- st.write(f"Interaction Point: ({touch_x:.1f}, {touch_y:.1f})")
281
- st.write(f"Duration: {touch_duration:.1f} s | Intensity: {touch_pressure:.2f}")
282
-
283
  # Create a futuristic data display
284
- data_display = f"""
285
  ```
286
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
287
- β”‚ Pressure : {{measured_pressure:.2f}} β”‚
288
- β”‚ Temperature : {{measured_temp:.2f}}Β°C β”‚
289
  β”‚ Texture : {measured_texture} β”‚
290
- β”‚ EM Field : {{measured_em:.2f}} ΞΌT β”‚
291
  β”‚ Quantum State: {quantum_state:.2f} β”‚
292
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
293
- β”‚ Pain Level : {{pain_level:.2f}} β”‚
294
- β”‚ Pleasure : {{pleasure_level:.2f}} β”‚
295
- β”‚ Tickle : {{tickle_level:.2f}} β”‚
296
- β”‚ Itch : {{itch_level:.2f}} β”‚
297
- β”‚ Proprioception: {{proprioception:.2f}} β”‚
298
  β”‚ Synesthesia : {synesthesia} β”‚
299
- β”‚ Neural Response: {{neural_response:.2f}} β”‚
300
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
301
  ```
302
  """
303
- st.code(data_display, language="")
304
-
305
- """
306
- st.code(data_display, language="")
307
- # Define the prompt_template and ai_response
308
-
309
- ai_response = f"" Based on the complex sensory input received, the hyper-advanced AI humanoid is experiencing a multifaceted neural response:
310
- The interaction at coordinates ({touch_x_str}, {touch_y_str}) has triggered a cascade of sensory information. The pressure of {measured_pressure_str} units has activated deep-tissue mechanoreceptors, while the temperature of {measured_temp_str}\N{DEGREE SIGN}C has stimulated thermoreceptors, creating a mild thermal gradient across the affected area.
311
-
312
- 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_str} ΞΌT, which is subtly influencing the local ionic channels in the AI's synthetic nervous system.
313
-
314
- The quantum state measurement of {quantum_state} suggests a delicate entanglement between the AI's quantum processors and the environment, potentially influencing decision-making processes at a subatomic level.
315
- The resulting pain level of {pain_level_str} and pleasure level of {pleasure_level_str} are creating a complex emotional response, balancing between discomfort and satisfaction. The tickle sensation ({tickle_level_str}) and itch response ({itch_level_str}) add layers of nuance to the overall tactile experience.
316
- The proprioception value of {proprioception_str} 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.
317
-
 
 
 
 
 
 
 
 
 
 
 
 
318
  {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."}
319
-
320
- The cumulative neural response of {neural_response_str} 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.
321
  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."""
322
- # Use the defined prompt_template and ai_response
323
- prompt = prompt_template.format(
324
- touch_x_str, touch_y_str,
325
- touch_duration_str, touch_pressure_str,
326
- measured_pressure_str, measured_temp_str,
327
- measured_texture, measured_em_str, quantum_state,
328
- pain_level_str, pleasure_level_str,
329
- tickle_level_str, itch_level_str,
330
- proprioception_str, synesthesia, neural_response_str
331
- )
332
- st.write("AI Response:")
333
- st.write(ai_response)
334
- # Define the prompt_template and ai_response
335
- prompt_template = (
336
- "Human: Analyze the sensory input for a hyper-advanced AI humanoid:\n"
337
- " Location: ({}, {})\n"
338
- " Duration: {}s, Intensity: {}\n"
339
- " Pressure: {}\n"
340
- " Temperature: {}\N{DEGREE SIGN}C\n"
341
- " Texture: {}\n"
342
- " EM Field: {} ΞΌT\n"
343
- " Quantum State: {}\n"
344
- " Resulting in:\n"
345
- " Pain: {}, Pleasure: {}\n"
346
- " Tickle: {}, Itch: {}\n"
347
- " Proprioception: {}\n"
348
- " Synesthesia: {}\n"
349
- " Neural Response: {}\n"
350
- " Provide a detailed, scientific, and creative description of the AI humanoid's experience and response to this sensory input."
351
- )
352
-
353
- ai_response = f"""Based on the complex sensory input received, the hyper-advanced AI humanoid is experiencing a multifaceted neural response:
354
-
355
- The interaction at coordinates ({touch_x_str}, {touch_y_str}) has triggered a cascade of sensory information. The pressure of {measured_pressure_str} units has activated deep-tissue mechanoreceptors, while the temperature of {measured_temp_str}\N{DEGREE SIGN}C has stimulated thermoreceptors, creating a mild thermal gradient across the affected area.
356
-
357
- 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_str} ΞΌT, which is subtly influencing the local ionic channels in the AI's synthetic nervous system.
358
 
359
- The quantum state measurement of {quantum_state} suggests a delicate entanglement between the AI's quantum processors and the environment, potentially influencing decision-making processes at a subatomic level.
360
- The resulting pain level of {pain_level_str} and pleasure level of {pleasure_level_str} are creating a complex emotional response, balancing between discomfort and satisfaction. The tickle sensation ({tickle_level_str}) and itch response ({itch_level_str}) add layers of nuance to the overall tactile experience.
361
- The proprioception value of {proprioception_str} 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.
362
-
363
- {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."}
364
-
365
- The cumulative neural response of {neural_response_str} 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.
366
- 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."""
367
- # Use the defined prompt_template and ai_response
368
- prompt = prompt_template.format(
369
- touch_x_str, touch_y_str,
370
- touch_duration_str, touch_pressure_str,
371
- measured_pressure_str, measured_temp_str,
372
- measured_texture, measured_em_str, quantum_state,
373
- pain_level_str, pleasure_level_str,
374
- tickle_level_str, itch_level_str,
375
- proprioception_str, synesthesia, neural_response_str
376
- )
377
- st.write("AI Response:")
378
- st.write(ai_response)
 
 
 
 
 
 
 
 
122
 
123
  avatar_sensation_map = create_sensation_map(AVATAR_WIDTH, AVATAR_HEIGHT)
124
 
125
+ # Create 3D humanoid avatar
126
  def create_3d_avatar():
127
+ # Head
128
+ head_x = np.array([0, 0, 1, 1, 0, 0, 1, 1]) * 20 + 290
129
+ head_y = np.array([0, 1, 1, 0, 0, 1, 1, 0]) * 40 + 50
130
+ head_z = np.array([0, 0, 0, 0, 1, 1, 1, 1]) * 20 + 120
131
+
132
+ # Torso
133
+ torso_x = np.array([0, 0, 1, 1, 0, 0, 1, 1]) * 40 + 270
134
+ torso_y = np.array([0, 1, 1, 0, 0, 1, 1, 0]) * 150 + 250
135
+ torso_z = np.array([0, 0, 0, 0, 1, 1, 1, 1]) * 30 + 90
136
+
137
+ # Arms
138
+ arm_x = np.array([0, 0, 1, 1, 0, 0, 1, 1]) * 20 + 200
139
+ arm_y = np.array([0, 1, 1, 0, 0, 1, 1, 0]) * 150 + 250
140
+ arm_z = np.array([0, 0, 0, 0, 1, 1, 1, 1]) * 20 + 90
141
+
142
+ # Legs
143
+ leg_x = np.array([0, 0, 1, 1, 0, 0, 1, 1]) * 40 + 280
144
+ leg_y = np.array([0, 1, 1, 0, 0, 1, 1, 0]) * 200 + 600
145
+ leg_z = np.array([0, 0, 0, 0, 1, 1, 1, 1]) * 40 + 60
146
+
147
+ # Combine all body parts
148
+ x = np.concatenate([head_x, torso_x, arm_x, arm_x, leg_x, leg_x])
149
+ y = np.concatenate([head_y, torso_y, arm_y, arm_y, leg_y, leg_y])
150
+ z = np.concatenate([head_z, torso_z, arm_z, arm_z, leg_z, leg_z])
151
+
152
  return go.Mesh3d(x=x, y=y, z=z, color='cyan', opacity=0.5)
153
 
154
  # Enhanced Autonomy Class
 
295
  neural_inputs = [pain_level, pleasure_level, measured_pressure, measured_temp, measured_em, tickle_level, itch_level, proprioception]
296
  neural_response = NeuralNetworkSimulator.process(neural_inputs)
297
 
 
 
 
 
298
  # Create a futuristic data display
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
+
320
+ # Define the prompt_template and ai_response
321
+ prompt_template = (
322
+ "Human: Analyze the sensory input for a hyper-advanced AI humanoid:\n"
323
+ " Location: ({}, {})\n"
324
+ " Duration: {}s, Intensity: {}\n"
325
+ " Pressure: {}\n"
326
+ " Temperature: {}\N{DEGREE SIGN}C\n"
327
+ " Texture: {}\n"
328
+ " EM Field: {} ΞΌT\n"
329
+ " Quantum State: {}\n"
330
+ " Resulting in:\n"
331
+ " Pain: {}, Pleasure: {}\n"
332
+ " Tickle: {}, Itch: {}\n"
333
+ " Proprioception: {}\n"
334
+ " Synesthesia: {}\n"
335
+ " Neural Response: {}\n"
336
+ " Provide a detailed, scientific, and creative description of the AI humanoid's experience and response to this sensory input."
337
+ )
338
+
339
+ ai_response = f""" Based on the complex sensory input received, the hyper-advanced AI humanoid is experiencing a multifaceted neural response:
340
+ 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.
341
+ 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.
342
+ 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.
343
+ 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.
344
+ 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.
345
  {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."}
346
+ 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.
 
347
  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."""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
348
 
349
+ st.write("AI Response:")
350
+ st.write(ai_response)
351
+
352
+ # Save interaction data
353
+ if canvas_result.json_data is not None:
354
+ objects = canvas_result.json_data["objects"]
355
+ if len(objects) > 0:
356
+ interaction_data = {
357
+ "touch_x": touch_x,
358
+ "touch_y": touch_y,
359
+ "touch_duration": touch_duration,
360
+ "touch_pressure": touch_pressure,
361
+ "measured_pressure": measured_pressure,
362
+ "measured_temp": measured_temp,
363
+ "measured_texture": measured_texture,
364
+ "measured_em": measured_em,
365
+ "quantum_state": quantum_state,
366
+ "pain_level": pain_level,
367
+ "pleasure_level": pleasure_level,
368
+ "tickle_level": tickle_level,
369
+ "itch_level": itch_level,
370
+ "proprioception": proprioception,
371
+ "synesthesia": synesthesia,
372
+ "neural_response": neural_response
373
+ }
374
+ filename = save_interaction(interaction_data)
375
+ st.write(f"