ANXLOG commited on
Commit
187997d
·
verified ·
1 Parent(s): 66e6d86

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -32
app.py CHANGED
@@ -8,13 +8,12 @@ import networkx as nx
8
  def generate_potentiality_matrix(sequence_length):
9
  """
10
  Visualizes the "Prime Potentiality" by aligning the integer stream to Mod 10.
11
- 1, 3, 7, 9 are the 'Active Lanes' (Rivers).
12
  """
13
- # 1. Create the Integer Stream
14
- # We go deep (up to 5000+) to show the river effect
15
  integers = np.arange(sequence_length)
16
 
17
- # 2. Mod 10 Alignment (The "Natural" Width)
18
  width = 10
19
  rows = int(np.ceil(sequence_length / width))
20
 
@@ -23,18 +22,21 @@ def generate_potentiality_matrix(sequence_length):
23
  padded_ints = np.pad(integers, (0, padded_len - len(integers)), mode='constant')
24
 
25
  # 3. Calculate "Potentiality" (The Heat)
26
- # 0 = Composite Ground, 0.5 = Potential Lane, 1.0 = Kinetic Prime
 
 
27
  matrix_values = np.zeros(padded_len)
28
 
29
  for i, val in enumerate(padded_ints):
30
- if sympy.isprime(int(val)) and val > 5:
 
31
  matrix_values[i] = 1.0 # Kinetic Signal (Prime)
32
- elif val % 2 == 0 or val % 5 == 0:
33
  matrix_values[i] = 0.0 # Ground State (Composite)
34
  else:
35
  matrix_values[i] = 0.2 # Potential Energy (Odd Composite in Prime Lane)
36
 
37
- # Reshape to Mod 10 Grid
38
  grid = matrix_values.reshape(rows, width)
39
 
40
  # 4. Visualization
@@ -51,11 +53,11 @@ def generate_potentiality_matrix(sequence_length):
51
  ))
52
 
53
  fig.update_layout(
54
- title=f"Prime Potentiality Rivers (Mod 10)",
55
  xaxis_title="Modulus 10 Residue (Last Digit)",
56
  yaxis_title="Sequence Depth (Time)",
57
  template="plotly_dark",
58
- yaxis=dict(autorange="reversed"), # Stream flows down
59
  height=800
60
  )
61
  return fig
@@ -69,7 +71,7 @@ def visualize_prime_matroska(shells, show_feed):
69
  fig = go.Figure()
70
 
71
  # 1. Draw the "Prime Vectors" (Spokes)
72
- # These are the rails the data travels on
73
  max_radius = shells * 10
74
  for i in range(10):
75
  angle = (2 * np.pi * i) / 10
@@ -78,6 +80,7 @@ def visualize_prime_matroska(shells, show_feed):
78
  color = "#00ffea" if is_prime_lane else "#333"
79
  width = 2 if is_prime_lane else 1
80
 
 
81
  fig.add_trace(go.Scatter(
82
  x=[0, max_radius * np.cos(angle)],
83
  y=[0, max_radius * np.sin(angle)],
@@ -88,7 +91,7 @@ def visualize_prime_matroska(shells, show_feed):
88
  ))
89
 
90
  # 2. Draw the Concentric Shells (Domains)
91
- # These are the Matroska Layers
92
  for layer in range(1, shells + 1):
93
  radius = layer * 10
94
  t = np.linspace(0, 2*np.pi, 100)
@@ -103,16 +106,17 @@ def visualize_prime_matroska(shells, show_feed):
103
  showlegend=False
104
  ))
105
 
106
- # 3. Simulate "Data Atoms" residing in the shell
107
- # They only land on the Prime Vectors (1, 3, 7, 9)
108
  if show_feed:
109
  for p_mod in [1, 3, 7, 9]:
110
  p_angle = (2 * np.pi * p_mod) / 10
 
111
  fig.add_trace(go.Scatter(
112
  x=[radius * np.cos(p_angle)],
113
  y=[radius * np.sin(p_angle)],
114
  mode='markers',
115
- marker=dict(size=6, color='#ff0055'), # Red = Hot Data
116
  showlegend=False
117
  ))
118
 
@@ -128,11 +132,11 @@ def visualize_prime_matroska(shells, show_feed):
128
 
129
  # --- THE INTERFACE ---
130
  with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
131
- gr.Markdown("# LOGOS: Prime-Indexed Topology")
132
- gr.Markdown("Visualizing the **Mod 10 Potentiality Rivers** and the **Radial Matroska Network**.")
133
 
134
  with gr.Tab("Prime Potentiality (Mod 10)"):
135
- gr.Markdown("The vertical 'Rivers' of prime potential (1, 3, 7, 9) vs the Composite banks.")
136
  seq_len = gr.Slider(100, 10000, value=2500, label="Stream Depth")
137
  matrix_plot = gr.Plot(label="Potentiality Matrix")
138
  btn_matrix = gr.Button("Generate Matrix")
@@ -148,18 +152,6 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
148
  btn_net = gr.Button("Build Topology")
149
  btn_net.click(visualize_prime_matroska, inputs=[shells_slider, feed_toggle], outputs=matroska_plot)
150
 
151
- # ... (rest of your code above stays the same)
152
-
153
- with gr.Tab("Matroska Network (Radial)"):
154
- gr.Markdown("The Destination Topology: Concentric Shells indexed by Prime Moduli.")
155
- with gr.Row():
156
- shells_slider = gr.Slider(1, 20, value=5, step=1, label="Domain Depth (Shells)")
157
- feed_toggle = gr.Checkbox(value=True, label="Show Active Atoms (Feed)")
158
-
159
- matroska_plot = gr.Plot(label="Radial Topology")
160
- btn_net = gr.Button("Build Topology")
161
- btn_net.click(visualize_prime_matroska, inputs=[shells_slider, feed_toggle], outputs=matroska_plot)
162
-
163
- # --- UPDATE THIS LAUNCH COMMAND ---
164
- # Disable SSR to fix the asyncio/file descriptor crash
165
  demo.launch(ssr_mode=False)
 
8
  def generate_potentiality_matrix(sequence_length):
9
  """
10
  Visualizes the "Prime Potentiality" by aligning the integer stream to Mod 10.
11
+ 1, 3, 7, 9 are the 'Active Lanes' (Rivers) where Primes can exist.
12
  """
13
+ # 1. Create the Integer Stream (Deep depth to show the 'River' effect)
 
14
  integers = np.arange(sequence_length)
15
 
16
+ # 2. Mod 10 Alignment (The "Natural" Width of the decimal system)
17
  width = 10
18
  rows = int(np.ceil(sequence_length / width))
19
 
 
22
  padded_ints = np.pad(integers, (0, padded_len - len(integers)), mode='constant')
23
 
24
  # 3. Calculate "Potentiality" (The Heat)
25
+ # 0.0 = Ground State (Even/5s - Composite)
26
+ # 0.2 = Potential Lane (Odd Composite in 1,3,7,9)
27
+ # 1.0 = Kinetic Signal (Actual Prime)
28
  matrix_values = np.zeros(padded_len)
29
 
30
  for i, val in enumerate(padded_ints):
31
+ val_int = int(val)
32
+ if sympy.isprime(val_int) and val_int > 5:
33
  matrix_values[i] = 1.0 # Kinetic Signal (Prime)
34
+ elif val_int % 2 == 0 or val_int % 5 == 0:
35
  matrix_values[i] = 0.0 # Ground State (Composite)
36
  else:
37
  matrix_values[i] = 0.2 # Potential Energy (Odd Composite in Prime Lane)
38
 
39
+ # Reshape to Mod 10 Grid (Rows x 10 Columns)
40
  grid = matrix_values.reshape(rows, width)
41
 
42
  # 4. Visualization
 
53
  ))
54
 
55
  fig.update_layout(
56
+ title=f"Prime Potentiality Rivers (Mod 10 Alignment)",
57
  xaxis_title="Modulus 10 Residue (Last Digit)",
58
  yaxis_title="Sequence Depth (Time)",
59
  template="plotly_dark",
60
+ yaxis=dict(autorange="reversed"), # Stream flows down like the matrix screenshots
61
  height=800
62
  )
63
  return fig
 
71
  fig = go.Figure()
72
 
73
  # 1. Draw the "Prime Vectors" (Spokes)
74
+ # These are the rails the data travels on based on the Mod 10 index
75
  max_radius = shells * 10
76
  for i in range(10):
77
  angle = (2 * np.pi * i) / 10
 
80
  color = "#00ffea" if is_prime_lane else "#333"
81
  width = 2 if is_prime_lane else 1
82
 
83
+ # Draw the vector spoke
84
  fig.add_trace(go.Scatter(
85
  x=[0, max_radius * np.cos(angle)],
86
  y=[0, max_radius * np.sin(angle)],
 
91
  ))
92
 
93
  # 2. Draw the Concentric Shells (Domains)
94
+ # These represent the Nested Matroska Layers
95
  for layer in range(1, shells + 1):
96
  radius = layer * 10
97
  t = np.linspace(0, 2*np.pi, 100)
 
106
  showlegend=False
107
  ))
108
 
109
+ # 3. Simulate "Active Atoms" (The Feed)
110
+ # Data atoms only inhabit the Prime Potentiality Vectors (1, 3, 7, 9)
111
  if show_feed:
112
  for p_mod in [1, 3, 7, 9]:
113
  p_angle = (2 * np.pi * p_mod) / 10
114
+ # Add 'Data' markers at the intersection of Shells and Prime Vectors
115
  fig.add_trace(go.Scatter(
116
  x=[radius * np.cos(p_angle)],
117
  y=[radius * np.sin(p_angle)],
118
  mode='markers',
119
+ marker=dict(size=6, color='#ff0055'), # Red = Hot Data Packet
120
  showlegend=False
121
  ))
122
 
 
132
 
133
  # --- THE INTERFACE ---
134
  with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
135
+ gr.Markdown("# LOGOS: Prime-Indexed Topology & Potentiality")
136
+ gr.Markdown("Interactive architectural validation for **Mod 10 Potentiality Rivers** and the **Radial Matroska Network**.")
137
 
138
  with gr.Tab("Prime Potentiality (Mod 10)"):
139
+ gr.Markdown("Visualizing the 'Vertical Rivers' of prime potential (1, 3, 7, 9) vs the Composite banks (0, 2, 4, 5, 6, 8).")
140
  seq_len = gr.Slider(100, 10000, value=2500, label="Stream Depth")
141
  matrix_plot = gr.Plot(label="Potentiality Matrix")
142
  btn_matrix = gr.Button("Generate Matrix")
 
152
  btn_net = gr.Button("Build Topology")
153
  btn_net.click(visualize_prime_matroska, inputs=[shells_slider, feed_toggle], outputs=matroska_plot)
154
 
155
+ # --- LAUNCH COMMAND ---
156
+ # Disable SSR (Server Side Rendering) to prevent asyncio/file descriptor crashes in HF Spaces
 
 
 
 
 
 
 
 
 
 
 
 
157
  demo.launch(ssr_mode=False)