ANXLOG commited on
Commit
8aa9098
·
verified ·
1 Parent(s): 76c263c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +76 -104
app.py CHANGED
@@ -4,91 +4,69 @@ import plotly.graph_objects as go
4
  import sympy
5
  import cv2
6
  import time
7
- import sys
8
- import os
9
  from collections import Counter
10
 
11
  # ==========================================
12
- # PART 1: THEORETICAL PRIMITIVES
13
  # ==========================================
14
 
15
  def get_gpf(n):
16
- """Returns the Greatest Prime Factor of n."""
17
  if n <= 1: return 1
18
  i = 2
19
- gpf = 1
20
  while i * i <= n:
21
  if n % i:
22
  i += 1
23
  else:
24
  n //= i
25
- gpf = i
26
- if n > 1:
27
- gpf = n
28
- return gpf
29
 
30
  def visualize_potentiality_flow():
31
  """
32
- Visualizes the 'Arrow' logic: Mod 10 digits directing flow into Prime Potentiality.
33
- Uses a Sankey Diagram to show 1, 3, 7, 9 as the only valid paths to 'P_n'.
34
  """
35
- # Nodes: [0: Source] -> [1-10: Digits 0-9] -> [11: Composite Sink] -> [12: Prime Potential]
36
- labels = ["Integer Stream"] + [f"Ends in {i}" for i in range(10)] + ["Composite Sink (Ground)", "Prime Potential (P_n)"]
37
 
38
- sources = []
39
- targets = []
40
- values = []
41
- colors = []
42
-
43
- # Link Source to Digits
44
  for i in range(10):
45
- sources.append(0)
46
- targets.append(i + 1)
47
- values.append(10)
48
- colors.append("#444") # Neutral stream
49
 
50
- # Link Digits to Destination
51
- prime_lanes = [1, 3, 7, 9] # Digits 1, 3, 7, 9
52
-
53
  for i in range(10):
54
- sources.append(i + 1)
55
  if i in prime_lanes:
56
- targets.append(12) # To Prime Potential
57
- values.append(10)
58
- colors.append("#00ffea") # Cyan Signal
59
  else:
60
- targets.append(11) # To Composite Sink
61
- values.append(10)
62
- colors.append("#ff0055") # Red Ground
63
 
64
  fig = go.Figure(data=[go.Sankey(
65
- node = dict(
66
- pad = 15, thickness = 20,
67
- line = dict(color = "black", width = 0.5),
68
- label = labels,
69
- color = ["white"] + ["#333"]*10 + ["#ff0055", "#00ffea"]
70
- ),
71
- link = dict(
72
- source = sources, target = targets, value = values, color = colors
73
- ))])
74
-
75
- fig.update_layout(title="Directed Graph: Mod 10 Prime Constraints", template="plotly_dark", height=600)
76
  return fig
77
 
78
  def visualize_prime_network(max_integer, show_links):
79
- """Visualizes the Radial Prime Topology with GPF Gravity."""
 
 
80
  fig = go.Figure()
81
- positions, gpf_map, prime_children_count = {}, {}, Counter()
82
 
83
  for n in range(1, max_integer + 1):
84
  angle = np.pi/2 - (2 * np.pi * (n % 10)) / 10 # Clockwise from Top
85
  radius = n
86
- x, y = radius * np.cos(angle), radius * np.sin(angle)
87
- positions[n] = (x, y)
88
  if n > 1 and not sympy.isprime(n):
89
  gpf = get_gpf(n)
90
  gpf_map[n] = gpf
91
- prime_children_count[gpf] += 1
92
 
93
  if show_links:
94
  edge_x, edge_y = [], []
@@ -96,50 +74,56 @@ def visualize_prime_network(max_integer, show_links):
96
  if base in positions:
97
  x0, y0 = positions[n]
98
  x1, y1 = positions[base]
99
- edge_x.extend([x0, x1, None]); edge_y.extend([y0, y1, None])
 
100
  fig.add_trace(go.Scatter(x=edge_x, y=edge_y, mode='lines', line=dict(color='rgba(100,100,100,0.15)', width=0.5), hoverinfo='none', name='GPF Gravity'))
101
 
102
- prime_x, prime_y, prime_size, prime_text = [], [], [], []
103
- comp_x, comp_y, comp_text = [], [], []
 
104
 
105
  for n in range(1, max_integer + 1):
106
  x, y = positions[n]
107
  if sympy.isprime(n) or n == 1:
108
- prime_x.append(x); prime_y.append(y)
109
- size = 5 + (np.log(prime_children_count[n] + 1) * 6)
110
- prime_size.append(size)
111
- prime_text.append(f"PRIME: {n}<br>Gravity: {prime_children_count[n]}")
112
  else:
113
- comp_x.append(x); comp_y.append(y)
114
- comp_text.append(f"Composite: {n}")
115
-
116
- fig.add_trace(go.Scatter(x=comp_x, y=comp_y, mode='markers', marker=dict(size=3, color='#ff0055', opacity=0.5), text=comp_text, hoverinfo='text', name='Composites'))
117
- fig.add_trace(go.Scatter(x=prime_x, y=prime_y, mode='markers', marker=dict(size=prime_size, color='#00ffea', line=dict(width=1, color='white')), text=prime_text, hoverinfo='text', name='Primes'))
118
 
 
 
 
 
119
  for i in range(10):
120
  angle = np.pi/2 - (2 * np.pi * i) / 10
121
- fig.add_trace(go.Scatter(x=[0, max_integer * 1.1 * np.cos(angle)], y=[0, max_integer * 1.1 * np.sin(angle)], mode='lines', line=dict(color='#222', width=1, dash='dot'), showlegend=False))
122
 
123
- fig.update_layout(title=f"Radial Prime-Indexed Topology (Max: {max_integer})", template="plotly_dark", height=800, width=800, xaxis=dict(visible=False), yaxis=dict(visible=False))
124
  return fig
125
 
126
  def visualize_gpf_counts(sequence_length):
127
- """Visualizes GPF Density."""
 
 
128
  gpf_counts = Counter()
129
  for n in range(4, sequence_length):
130
  if not sympy.isprime(n): gpf_counts[get_gpf(n)] += 1
 
131
  sorted_gpfs = sorted(gpf_counts.keys())
132
  counts = [gpf_counts[p] for p in sorted_gpfs]
 
133
  fig = go.Figure(data=go.Bar(x=sorted_gpfs, y=counts, marker_color='#ff7f00', name="Composite Count"))
134
  fig.update_layout(title="Composite Density by GPF Base", xaxis_title="Prime Base", yaxis_title="Count", template="plotly_dark", xaxis=dict(type='category'))
135
  return fig
136
 
137
  # ==========================================
138
- # PART 2: DSP ENGINE (AUTOMATED)
139
  # ==========================================
140
 
141
  def calculate_ssim(img1, img2):
142
- """Calculates Structural Similarity (Quality Metric)."""
143
  C1, C2 = (0.01 * 255)**2, (0.03 * 255)**2
144
  img1, img2 = img1.astype(np.float64), img2.astype(np.float64)
145
  kernel = cv2.getGaussianKernel(11, 1.5)
@@ -151,34 +135,29 @@ def calculate_ssim(img1, img2):
151
  sigma12 = cv2.filter2D(img1*img2, -1, window)[5:-5, 5:-5] - mu1_mu2
152
  return ((2 * mu1_mu2 + C1) * (2 * sigma12 + C2)) / ((mu1_sq + mu2_sq + C1) * (sigma1_sq + sigma2_sq + C2))
153
 
154
- def run_logos_auto_bake(image):
155
  """
156
- AUTOMATED BAKER: No sliders.
157
- 1. Calculates internal entropy (Global Variance).
158
- 2. Sets heat tolerance automatically.
159
- 3. Decomposes stream.
160
- 4. Validates Delta Heat Checksum.
161
  """
162
- if image is None: return None, None, "No Signal"
163
 
164
- # 1. Pre-process (Grayscale)
165
  if len(image.shape) == 3: gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
166
  else: gray = image
167
  h, w = gray.shape
168
 
169
- # 2. INTERNAL HEAT CALCULATION (Automatic Tolerance)
170
  global_variance = np.std(gray)
171
- # Heuristic: Higher variance needs higher tolerance to prevent over-splitting,
172
- # OR lower tolerance to capture detail?
173
- # LOGOS Logic: We want to capture the CHANGE.
174
- # Fixed ratio based on the "Hades Frame" success.
175
- auto_tolerance = global_variance * 0.15
176
 
177
  start_time = time.time()
178
  atoms = []
179
  delta_heat_sum = 0
180
 
181
- # 3. RECURSIVE DISSOLUTION
182
  def recursive_bake(x, y, w, h):
183
  nonlocal delta_heat_sum
184
  region = gray[y:y+h, x:x+w]
@@ -186,7 +165,7 @@ def run_logos_auto_bake(image):
186
 
187
  local_heat = np.std(region)
188
 
189
- # Split Decision (Phase Change)
190
  if local_heat > auto_tolerance and w > 4:
191
  hw, hh = w // 2, h // 2
192
  recursive_bake(x, y, hw, hh)
@@ -194,33 +173,31 @@ def run_logos_auto_bake(image):
194
  recursive_bake(x, y+hh, hw, h-hh)
195
  recursive_bake(x+hw, y+hh, w-hw, h-hh)
196
  else:
197
- # PERSIST ATOM (00 State)
198
  avg_val = int(np.mean(region))
199
  atoms.append((x, y, w, h, avg_val))
200
- # Delta Heat: The "Energy" lost by averaging this block
201
- # In a real video stream, this confirms the package integrity
202
  delta_heat_sum += local_heat
203
 
204
  recursive_bake(0, 0, w, h)
205
- latency = (time.time() - start_time) * 1000 # ms
206
 
207
- # 4. RECONSTRUCTION
208
  reconstructed = np.zeros_like(gray)
209
  heatmap_vis = np.zeros((h, w, 3), dtype=np.uint8)
210
 
211
  for (x, y, cw, ch, val) in atoms:
212
  reconstructed[y:y+ch, x:x+cw] = val
213
- # Visualization: Red=High Freq (Change), Cyan=Low Freq (Persist)
214
  is_hot = cw < 16
215
  color = (255, 0, 85) if is_hot else (0, 255, 234)
216
  cv2.rectangle(heatmap_vis, (x, y), (x+cw, y+ch), color, -1 if is_hot else 1)
217
 
218
- # 5. TELEMETRY & CHECKSUM
219
  ssim = calculate_ssim(gray, reconstructed).mean()
220
  comp_ratio = 100 * (1 - (len(atoms) * 5) / (w * h))
221
 
222
- # The Checksum: Does the heat match the atom count?
223
- checksum_valid = "PASS" if delta_heat_sum > 0 else "FAIL"
224
 
225
  stats = (
226
  f"LOGOS TELEMETRY [AUTO-PILOT]\n"
@@ -231,7 +208,7 @@ def run_logos_auto_bake(image):
231
  f"Atom Count: {len(atoms)}\n"
232
  f"Compression: {comp_ratio:.1f}%\n"
233
  f"SSIM Fidelity: {ssim:.4f}\n"
234
- f"Delta Heat Checksum: {checksum_valid} ({int(delta_heat_sum)})"
235
  )
236
 
237
  return cv2.cvtColor(reconstructed, cv2.COLOR_GRAY2RGB), heatmap_vis, stats
@@ -242,18 +219,15 @@ def run_logos_auto_bake(image):
242
 
243
  def build_demo():
244
  with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
245
- gr.Markdown("# LOGOS: Systems Architecture & DSP Validator")
246
- gr.Markdown("Validating **Directed Prime Constraints**, **Radial Topology**, and **Automated Stream Dissolution**.")
247
 
248
  with gr.Tabs():
249
- # TAB 1: THEORY
250
- with gr.Tab("1. Prime Potentiality (Directed Flow)"):
251
- gr.Markdown("Visualizing the digit constraints (1, 3, 7, 9) that direct the stream into Prime Potential.")
252
  btn_flow = gr.Button("Generate Flow Graph")
253
  flow_plot = gr.Plot(label="Sankey Diagram")
254
  btn_flow.click(visualize_potentiality_flow, outputs=flow_plot)
255
 
256
- # TAB 2: TOPOLOGY
257
  with gr.Tab("2. Radial Prime Network"):
258
  gr.Markdown("The **Natural Tessellation**: Composites anchored to their GPF Base.")
259
  with gr.Row():
@@ -263,7 +237,6 @@ def build_demo():
263
  btn_net = gr.Button("Build Network")
264
  btn_net.click(visualize_prime_network, inputs=[rad_len, link_toggle], outputs=net_plot)
265
 
266
- # TAB 3: ANALYSIS
267
  with gr.Tab("3. GPF Density"):
268
  gr.Markdown("Analyzing the 'Heat' generated by each Prime Base.")
269
  gpf_len = gr.Slider(100, 10000, value=2500, label="Stream Depth")
@@ -271,20 +244,19 @@ def build_demo():
271
  btn_gpf = gr.Button("Calculate Density")
272
  btn_gpf.click(visualize_gpf_counts, inputs=[gpf_len], outputs=gpf_plot)
273
 
274
- # TAB 4: THE LAB (AUTO)
275
  with gr.Tab("4. Auto-Stream Baker"):
276
- gr.Markdown("**No Sliders.** The system analyzes image entropy and sets the Heat Threshold automatically.")
277
  with gr.Row():
278
  with gr.Column():
279
- inp_img = gr.Image(label="Source Signal (Drop 'Hades Frame' Here)", type="numpy", height=300)
280
  btn_run = gr.Button("TRANSMIT STREAM", variant="primary")
281
- out_stats = gr.Textbox(label="DSP Telemetry", lines=7)
282
 
283
  with gr.Column():
284
  out_img = gr.Image(label="Reconstructed Signal")
285
  out_heat = gr.Image(label="Dissolution Map (Delta Heat)")
286
 
287
- btn_run.click(run_logos_auto_bake, inputs=[inp_img], outputs=[out_img, out_heat, out_stats])
288
 
289
  return demo
290
 
 
4
  import sympy
5
  import cv2
6
  import time
 
 
7
  from collections import Counter
8
 
9
  # ==========================================
10
+ # PART 1: THEORETICAL VISUALIZATIONS
11
  # ==========================================
12
 
13
  def get_gpf(n):
14
+ """Returns the Greatest Prime Factor."""
15
  if n <= 1: return 1
16
  i = 2
 
17
  while i * i <= n:
18
  if n % i:
19
  i += 1
20
  else:
21
  n //= i
22
+ return n
 
 
 
23
 
24
  def visualize_potentiality_flow():
25
  """
26
+ Tab 1: Directed Graph (Sankey) showing Digit Constraints.
 
27
  """
28
+ labels = ["Integer Stream"] + [f"Ends in {i}" for i in range(10)] + ["Composite Sink", "Prime Potential (P_n)"]
29
+ sources, targets, values, colors = [], [], [], []
30
 
31
+ # Layer 1: Stream -> Digits
 
 
 
 
 
32
  for i in range(10):
33
+ sources.append(0); targets.append(i+1); values.append(10); colors.append("#444")
 
 
 
34
 
35
+ # Layer 2: Digits -> Destination
36
+ prime_lanes = [1, 3, 7, 9]
 
37
  for i in range(10):
38
+ sources.append(i+1)
39
  if i in prime_lanes:
40
+ targets.append(12) # Prime Potential
41
+ colors.append("#00ffea") # Cyan
 
42
  else:
43
+ targets.append(11) # Sink
44
+ colors.append("#ff0055") # Red
45
+ values.append(10)
46
 
47
  fig = go.Figure(data=[go.Sankey(
48
+ node=dict(pad=15, thickness=20, line=dict(color="black", width=0.5), label=labels, color=["white"]+["#333"]*10+["#ff0055", "#00ffea"]),
49
+ link=dict(source=sources, target=targets, value=values, color=colors)
50
+ )])
51
+ fig.update_layout(title="Prime Potentiality Flow (Mod 10 Constraints)", template="plotly_dark", height=600)
 
 
 
 
 
 
 
52
  return fig
53
 
54
  def visualize_prime_network(max_integer, show_links):
55
+ """
56
+ Tab 2: Radial Topology.
57
+ """
58
  fig = go.Figure()
59
+ positions, gpf_map, prime_counts = {}, {}, Counter()
60
 
61
  for n in range(1, max_integer + 1):
62
  angle = np.pi/2 - (2 * np.pi * (n % 10)) / 10 # Clockwise from Top
63
  radius = n
64
+ positions[n] = (radius * np.cos(angle), radius * np.sin(angle))
65
+
66
  if n > 1 and not sympy.isprime(n):
67
  gpf = get_gpf(n)
68
  gpf_map[n] = gpf
69
+ prime_counts[gpf] += 1
70
 
71
  if show_links:
72
  edge_x, edge_y = [], []
 
74
  if base in positions:
75
  x0, y0 = positions[n]
76
  x1, y1 = positions[base]
77
+ edge_x.extend([x0, x1, None])
78
+ edge_y.extend([y0, y1, None])
79
  fig.add_trace(go.Scatter(x=edge_x, y=edge_y, mode='lines', line=dict(color='rgba(100,100,100,0.15)', width=0.5), hoverinfo='none', name='GPF Gravity'))
80
 
81
+ # Draw Nodes
82
+ px, py, ps, pt = [], [], [], []
83
+ cx, cy, ct = [], [], []
84
 
85
  for n in range(1, max_integer + 1):
86
  x, y = positions[n]
87
  if sympy.isprime(n) or n == 1:
88
+ px.append(x); py.append(y)
89
+ ps.append(5 + (np.log(prime_counts[n]+1)*6))
90
+ pt.append(f"PRIME: {n}<br>Gravity: {prime_counts[n]}")
 
91
  else:
92
+ cx.append(x); cy.append(y)
93
+ ct.append(f"Composite: {n}")
 
 
 
94
 
95
+ fig.add_trace(go.Scatter(x=cx, y=cy, mode='markers', marker=dict(size=3, color='#ff0055', opacity=0.5), text=ct, hoverinfo='text', name='Composites'))
96
+ fig.add_trace(go.Scatter(x=px, y=py, mode='markers', marker=dict(size=ps, color='#00ffea', line=dict(width=1, color='white')), text=pt, hoverinfo='text', name='Primes'))
97
+
98
+ # Spokes
99
  for i in range(10):
100
  angle = np.pi/2 - (2 * np.pi * i) / 10
101
+ fig.add_trace(go.Scatter(x=[0, max_integer*1.1*np.cos(angle)], y=[0, max_integer*1.1*np.sin(angle)], mode='lines', line=dict(color='#222', width=1, dash='dot'), showlegend=False))
102
 
103
+ fig.update_layout(title=f"Radial Prime-Indexed Topology", template="plotly_dark", height=800, width=800, xaxis=dict(visible=False), yaxis=dict(visible=False))
104
  return fig
105
 
106
  def visualize_gpf_counts(sequence_length):
107
+ """
108
+ Tab 3: GPF Density (The Orange Graph).
109
+ """
110
  gpf_counts = Counter()
111
  for n in range(4, sequence_length):
112
  if not sympy.isprime(n): gpf_counts[get_gpf(n)] += 1
113
+
114
  sorted_gpfs = sorted(gpf_counts.keys())
115
  counts = [gpf_counts[p] for p in sorted_gpfs]
116
+
117
  fig = go.Figure(data=go.Bar(x=sorted_gpfs, y=counts, marker_color='#ff7f00', name="Composite Count"))
118
  fig.update_layout(title="Composite Density by GPF Base", xaxis_title="Prime Base", yaxis_title="Count", template="plotly_dark", xaxis=dict(type='category'))
119
  return fig
120
 
121
  # ==========================================
122
+ # PART 2: THE REAL AUTO-BAKER (EMBEDDED LOGIC)
123
  # ==========================================
124
 
125
  def calculate_ssim(img1, img2):
126
+ """Calculates Quality (SSIM) of the reconstructed signal."""
127
  C1, C2 = (0.01 * 255)**2, (0.03 * 255)**2
128
  img1, img2 = img1.astype(np.float64), img2.astype(np.float64)
129
  kernel = cv2.getGaussianKernel(11, 1.5)
 
135
  sigma12 = cv2.filter2D(img1*img2, -1, window)[5:-5, 5:-5] - mu1_mu2
136
  return ((2 * mu1_mu2 + C1) * (2 * sigma12 + C2)) / ((mu1_sq + mu2_sq + C1) * (sigma1_sq + sigma2_sq + C2))
137
 
138
+ def run_auto_bake(image):
139
  """
140
+ THE BAKER (Internal Logic).
141
+ Calculates Auto-Tolerance based on Global Variance.
142
+ Decomposes stream and verifies Delta Heat Checksum.
 
 
143
  """
144
+ if image is None: return None, None, "Waiting for Signal..."
145
 
146
+ # 1. Pre-process
147
  if len(image.shape) == 3: gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
148
  else: gray = image
149
  h, w = gray.shape
150
 
151
+ # 2. CALCULATION: Internal Entropy -> Auto-Tolerance
152
  global_variance = np.std(gray)
153
+ # The LOGOS constant derived from your testing
154
+ auto_tolerance = global_variance * 0.2
 
 
 
155
 
156
  start_time = time.time()
157
  atoms = []
158
  delta_heat_sum = 0
159
 
160
+ # 3. RECURSIVE DISSOLUTION (Quadtree)
161
  def recursive_bake(x, y, w, h):
162
  nonlocal delta_heat_sum
163
  region = gray[y:y+h, x:x+w]
 
165
 
166
  local_heat = np.std(region)
167
 
168
+ # Split Logic (Phase Change)
169
  if local_heat > auto_tolerance and w > 4:
170
  hw, hh = w // 2, h // 2
171
  recursive_bake(x, y, hw, hh)
 
173
  recursive_bake(x, y+hh, hw, h-hh)
174
  recursive_bake(x+hw, y+hh, w-hw, h-hh)
175
  else:
176
+ # PERSIST ATOM (00)
177
  avg_val = int(np.mean(region))
178
  atoms.append((x, y, w, h, avg_val))
 
 
179
  delta_heat_sum += local_heat
180
 
181
  recursive_bake(0, 0, w, h)
182
+ latency = (time.time() - start_time) * 1000
183
 
184
+ # 4. RECONSTRUCTION & VISUALIZATION
185
  reconstructed = np.zeros_like(gray)
186
  heatmap_vis = np.zeros((h, w, 3), dtype=np.uint8)
187
 
188
  for (x, y, cw, ch, val) in atoms:
189
  reconstructed[y:y+ch, x:x+cw] = val
190
+ # Heatmap: Red = Small (Hot), Cyan = Large (Cold)
191
  is_hot = cw < 16
192
  color = (255, 0, 85) if is_hot else (0, 255, 234)
193
  cv2.rectangle(heatmap_vis, (x, y), (x+cw, y+ch), color, -1 if is_hot else 1)
194
 
195
+ # 5. TELEMETRY
196
  ssim = calculate_ssim(gray, reconstructed).mean()
197
  comp_ratio = 100 * (1 - (len(atoms) * 5) / (w * h))
198
 
199
+ # Checksum Verification
200
+ checksum_status = "VALID" if delta_heat_sum > 0 else "INVALID"
201
 
202
  stats = (
203
  f"LOGOS TELEMETRY [AUTO-PILOT]\n"
 
208
  f"Atom Count: {len(atoms)}\n"
209
  f"Compression: {comp_ratio:.1f}%\n"
210
  f"SSIM Fidelity: {ssim:.4f}\n"
211
+ f"Delta Heat Checksum: {int(delta_heat_sum)} ({checksum_status})"
212
  )
213
 
214
  return cv2.cvtColor(reconstructed, cv2.COLOR_GRAY2RGB), heatmap_vis, stats
 
219
 
220
  def build_demo():
221
  with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
222
+ gr.Markdown("# LOGOS: Prime-Indexed Topology & Automated Compression")
 
223
 
224
  with gr.Tabs():
225
+ with gr.Tab("1. Prime Potentiality (Flow)"):
226
+ gr.Markdown("Visualizing the '1, 3, 7, 9' Digit Constraints.")
 
227
  btn_flow = gr.Button("Generate Flow Graph")
228
  flow_plot = gr.Plot(label="Sankey Diagram")
229
  btn_flow.click(visualize_potentiality_flow, outputs=flow_plot)
230
 
 
231
  with gr.Tab("2. Radial Prime Network"):
232
  gr.Markdown("The **Natural Tessellation**: Composites anchored to their GPF Base.")
233
  with gr.Row():
 
237
  btn_net = gr.Button("Build Network")
238
  btn_net.click(visualize_prime_network, inputs=[rad_len, link_toggle], outputs=net_plot)
239
 
 
240
  with gr.Tab("3. GPF Density"):
241
  gr.Markdown("Analyzing the 'Heat' generated by each Prime Base.")
242
  gpf_len = gr.Slider(100, 10000, value=2500, label="Stream Depth")
 
244
  btn_gpf = gr.Button("Calculate Density")
245
  btn_gpf.click(visualize_gpf_counts, inputs=[gpf_len], outputs=gpf_plot)
246
 
 
247
  with gr.Tab("4. Auto-Stream Baker"):
248
+ gr.Markdown("**Automated Entropy Analysis.** Drop an image (e.g., Hades Frame) to test the Auto-Tolerance and Checksum.")
249
  with gr.Row():
250
  with gr.Column():
251
+ inp_img = gr.Image(label="Source Signal", type="numpy", height=300)
252
  btn_run = gr.Button("TRANSMIT STREAM", variant="primary")
253
+ out_stats = gr.Textbox(label="DSP Telemetry", lines=8)
254
 
255
  with gr.Column():
256
  out_img = gr.Image(label="Reconstructed Signal")
257
  out_heat = gr.Image(label="Dissolution Map (Delta Heat)")
258
 
259
+ btn_run.click(run_auto_bake, inputs=[inp_img], outputs=[out_img, out_heat, out_stats])
260
 
261
  return demo
262