SSCROW commited on
Commit
de91a30
Β·
verified Β·
1 Parent(s): 1e0409e

Update SSCrow Ai

Browse files
Files changed (1) hide show
  1. SSCrow Ai +555 -13
SSCrow Ai CHANGED
@@ -1,17 +1,559 @@
1
- # 1. Create project and install
2
- mkdir sscrow-ai && cd sscrow-ai
3
- pip install -r requirements.txt
 
4
 
5
- # 2. Run the app
6
- python app.py
 
 
 
 
7
 
8
- # 3. Open browser
9
- # Visit: http://localhost:7860 # Terminal 1: Start Backend
10
- cd sscrow-backend
11
- npm start
12
 
13
- # Terminal 2: Start Gradio AI
14
- cd sscrow-ai
15
- python app.py
16
 
17
- # Access: http://localhost:7860
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ S.S.CROW PROTOCOL - GRADIO INTERFACE
3
+ Complete AI-powered analysis system with Transformers integration
4
+ """
5
 
6
+ import gradio as gr
7
+ import torch
8
+ from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
9
+ import json
10
+ import requests
11
+ from datetime import datetime
12
 
13
+ # ============================================
14
+ # CONFIGURATION
15
+ # ============================================
 
16
 
17
+ SSCROW_API = "http://localhost:3000/api/v1"
18
+ OLLAMA_API = "http://localhost:11434/api/generate"
 
19
 
20
+ # S.S.CROW Constants
21
+ SSCROW_FREQUENCY = 80192
22
+ NEXUS_VALUE = 1166
23
+ PACKET_SIZE = 1.0 # kh
24
+
25
+ # ============================================
26
+ # AI MODEL INITIALIZATION
27
+ # ============================================
28
+
29
+ print("πŸ”„ Initializing S.S.CROW AI Systems...")
30
+ device = "cuda" if torch.cuda.is_available() else "cpu"
31
+ print(f"⚑ Compute Device: {device.upper()}")
32
+
33
+ # Initialize sentiment analyzer
34
+ try:
35
+ sentiment_analyzer = pipeline(
36
+ "sentiment-analysis",
37
+ model="distilbert-base-uncased-finetuned-sst-2-english",
38
+ device=0 if device == "cuda" else -1
39
+ )
40
+ print("βœ“ Sentiment Analysis Module: ONLINE")
41
+ except Exception as e:
42
+ sentiment_analyzer = None
43
+ print(f"⚠ Sentiment Analysis Module: OFFLINE ({e})")
44
+
45
+ # Initialize text generator (smaller model for compatibility)
46
+ try:
47
+ generator = pipeline(
48
+ "text-generation",
49
+ model="distilgpt2",
50
+ device=0 if device == "cuda" else -1
51
+ )
52
+ print("βœ“ Text Generation Module: ONLINE")
53
+ except Exception as e:
54
+ generator = None
55
+ print(f"⚠ Text Generation Module: OFFLINE ({e})")
56
+
57
+ print("βœ“ S.S.CROW AI Systems Ready\n")
58
+
59
+ # ============================================
60
+ # CORE PROCESSING FUNCTIONS
61
+ # ============================================
62
+
63
+ def calculate_zcf_metrics(input_text):
64
+ """Calculate ZCF field metrics based on input"""
65
+ # Use text length and content for deterministic calculations
66
+ text_hash = sum(ord(c) for c in input_text)
67
+
68
+ field_strength = (text_hash % 100) + 1
69
+ stability = min(100, (len(input_text) * 7) % 100 + 50)
70
+ resonance = (text_hash % 50) + 50
71
+
72
+ return {
73
+ "field_strength": field_strength,
74
+ "stability": stability,
75
+ "resonance": resonance,
76
+ "keyhole_alignment": "OPTIMAL" if stability > 75 else "CALIBRATING"
77
+ }
78
+
79
+ def process_intake(input_val):
80
+ """Main processing function - S.S.CROW packet logic"""
81
+ if not input_val or not input_val.strip():
82
+ return "⚠ ERROR: No input detected. Awaiting transmission..."
83
+
84
+ timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
85
+
86
+ # Calculate ZCF metrics
87
+ metrics = calculate_zcf_metrics(input_val)
88
+
89
+ # Build response
90
+ response = f"""╔════════════════════════════════════════╗
91
+ β•‘ S.S.CROW PROTOCOL ANALYSIS β•‘
92
+ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
93
+
94
+ ⚑ TRANSMISSION RECEIVED
95
+ β”œβ”€ Timestamp: {timestamp}
96
+ β”œβ”€ Input Length: {len(input_val)} chars
97
+ └─ Packet Size: {PACKET_SIZE} kh
98
+
99
+ πŸ”· ZCF FIELD METRICS
100
+ β”œβ”€ Field Strength: {metrics['field_strength']}%
101
+ β”œβ”€ Stability Index: {metrics['stability']}%
102
+ β”œβ”€ Resonance Level: {metrics['resonance']}%
103
+ └─ Keyhole Alignment: {metrics['keyhole_alignment']}
104
+
105
+ πŸ“‘ SYSTEM STATUS
106
+ β”œβ”€ S.S.CROW Frequency: {SSCROW_FREQUENCY} Hz
107
+ β”œβ”€ Nexus Terminal Sum: {NEXUS_VALUE}
108
+ β”œβ”€ Compute Device: {device.upper()}
109
+ └─ Status: OPERATIONAL
110
+
111
+ 🎯 ANALYSIS COMPLETE
112
+ Input processed through geometric stress matrix.
113
+ Skeleton Keyhole geometry verified.
114
+ Ready for traversal sequence."""
115
+
116
+ return response
117
+
118
+ def ai_sentiment_analysis(text):
119
+ """Analyze sentiment using Transformers"""
120
+ if not sentiment_analyzer:
121
+ return "⚠ Sentiment Analysis Module OFFLINE"
122
+
123
+ if not text or not text.strip():
124
+ return "⚠ No text provided"
125
+
126
+ try:
127
+ result = sentiment_analyzer(text[:512])[0] # Limit to 512 chars
128
+ label = result['label']
129
+ score = result['score']
130
+
131
+ return f"""╔════════════════════════════════════════╗
132
+ β•‘ SENTIMENT ANALYSIS REPORT β•‘
133
+ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
134
+
135
+ πŸ“Š CLASSIFICATION: {label}
136
+ πŸ“ˆ Confidence: {score:.2%}
137
+
138
+ πŸ” INTERPRETATION:
139
+ {"Positive emotional resonance detected." if label == "POSITIVE" else "Negative emotional resonance detected."}
140
+ Field stability: {"HIGH" if score > 0.9 else "MODERATE" if score > 0.7 else "LOW"}
141
+
142
+ Device: {device.upper()}
143
+ Model: DistilBERT-SST2"""
144
+ except Exception as e:
145
+ return f"⚠ Analysis Error: {str(e)}"
146
+
147
+ def ai_text_generation(prompt):
148
+ """Generate text using Transformers"""
149
+ if not generator:
150
+ return "⚠ Text Generation Module OFFLINE"
151
+
152
+ if not prompt or not prompt.strip():
153
+ return "⚠ No prompt provided"
154
+
155
+ try:
156
+ result = generator(
157
+ prompt,
158
+ max_length=150,
159
+ num_return_sequences=1,
160
+ temperature=0.7,
161
+ do_sample=True
162
+ )[0]['generated_text']
163
+
164
+ return f"""╔════════════════════════════════════════╗
165
+ β•‘ AI TEXT GENERATION β•‘
166
+ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
167
+
168
+ πŸ“ GENERATED OUTPUT:
169
+
170
+ {result}
171
+
172
+ ---
173
+ Device: {device.upper()}
174
+ Model: DistilGPT2
175
+ Temperature: 0.7"""
176
+ except Exception as e:
177
+ return f"⚠ Generation Error: {str(e)}"
178
+
179
+ def query_ollama(prompt, model="llama3"):
180
+ """Query local Ollama instance"""
181
+ try:
182
+ response = requests.post(
183
+ OLLAMA_API,
184
+ json={
185
+ "model": model,
186
+ "prompt": prompt,
187
+ "stream": False,
188
+ "system": "You are the MULE-Link AI system. Provide technical analysis of ZCF field topology and geometric stress calculations."
189
+ },
190
+ timeout=60
191
+ )
192
+
193
+ if response.status_code == 200:
194
+ data = response.json()
195
+ return f"""╔════════════════════════════════════════╗
196
+ β•‘ OLLAMA MULE-LINK RESPONSE β•‘
197
+ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
198
+
199
+ {data.get('response', 'No response')}
200
+
201
+ ---
202
+ Model: {model}
203
+ Status: ONLINE"""
204
+ else:
205
+ return f"⚠ Ollama returned status {response.status_code}"
206
+
207
+ except requests.exceptions.ConnectionError:
208
+ return "⚠ Cannot connect to Ollama. Ensure 'ollama serve' is running."
209
+ except Exception as e:
210
+ return f"⚠ Ollama Query Error: {str(e)}"
211
+
212
+ def send_email_api(to, subject, body):
213
+ """Send email via SSCROW API"""
214
+ if not all([to, subject, body]):
215
+ return "⚠ ERROR: All fields required (TO, SUBJECT, BODY)"
216
+
217
+ try:
218
+ response = requests.post(
219
+ f"{SSCROW_API}/send",
220
+ json={
221
+ "cmd": "SEND",
222
+ "to": to,
223
+ "subject": subject,
224
+ "body": body,
225
+ "timestamp": datetime.now().isoformat()
226
+ },
227
+ timeout=10
228
+ )
229
+
230
+ if response.status_code == 200:
231
+ data = response.json()
232
+ return f"""βœ“ TRANSMISSION DELIVERED
233
+
234
+ Email ID: {data.get('emailId', 'N/A')}
235
+ Timestamp: {data.get('timestamp', 'N/A')}
236
+ Status: {data.get('message', 'SENT')}"""
237
+ else:
238
+ return f"⚠ Transmission failed: HTTP {response.status_code}"
239
+
240
+ except requests.exceptions.ConnectionError:
241
+ return f"⚠ Cannot connect to SSCROW API at {SSCROW_API}"
242
+ except Exception as e:
243
+ return f"⚠ Email Error: {str(e)}"
244
+
245
+ def fetch_inbox_api():
246
+ """Fetch inbox from SSCROW API"""
247
+ try:
248
+ response = requests.get(f"{SSCROW_API}/inbox", timeout=10)
249
+
250
+ if response.status_code == 200:
251
+ data = response.json()
252
+ messages = data.get('messages', [])
253
+
254
+ if not messages:
255
+ return "πŸ“₯ INBOX EMPTY - No transmissions received"
256
+
257
+ output = f"""╔════════════════════════════════════════╗
258
+ β•‘ SECURE MAILBOX β•‘
259
+ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
260
+
261
+ Total Messages: {data.get('count', 0)}
262
+ Unread: {data.get('unread', 0)}
263
+
264
+ """
265
+ for msg in messages[:10]: # Show latest 10
266
+ status = "πŸ”΄ NEW" if not msg.get('read') else "βœ“ Read"
267
+ output += f"""───────────────────────────────────────
268
+ {status} | {msg.get('timestamp', 'N/A')}
269
+ FROM: {msg.get('from', 'UNKNOWN')}
270
+ SUBJECT: {msg.get('subject', 'No Subject')}
271
+ BODY: {msg.get('body', '')[:100]}...
272
+
273
+ """
274
+ return output
275
+ else:
276
+ return f"⚠ Failed to fetch inbox: HTTP {response.status_code}"
277
+
278
+ except requests.exceptions.ConnectionError:
279
+ return f"⚠ Cannot connect to SSCROW API at {SSCROW_API}"
280
+ except Exception as e:
281
+ return f"⚠ Inbox Error: {str(e)}"
282
+
283
+ def seed_lattice_api():
284
+ """Seed ZCF lattice via API"""
285
+ try:
286
+ response = requests.post(
287
+ f"{SSCROW_API}/send",
288
+ json={"cmd": "SEED"},
289
+ timeout=10
290
+ )
291
+
292
+ if response.status_code == 200:
293
+ data = response.json()
294
+ return f"""⚑ LATTICE SEED COMPLETE
295
+
296
+ Status: {data.get('message', 'SUCCESS')}
297
+ Timestamp: {data.get('timestamp', 'N/A')}
298
+
299
+ ZCF topology initialized.
300
+ Skeleton Keyhole geometry active.
301
+ System ready for traversal."""
302
+ else:
303
+ return f"⚠ Lattice seeding failed: HTTP {response.status_code}"
304
+
305
+ except requests.exceptions.ConnectionError:
306
+ return f"⚠ Cannot connect to SSCROW API at {SSCROW_API}"
307
+ except Exception as e:
308
+ return f"⚠ Lattice Seed Error: {str(e)}"
309
+
310
+ def system_diagnostics():
311
+ """Run system diagnostics"""
312
+ diagnostics = f"""╔════════════════════════════════════════╗
313
+ β•‘ SYSTEM DIAGNOSTICS REPORT β•‘
314
+ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
315
+
316
+ βš™οΈ HARDWARE
317
+ β”œβ”€ Compute Device: {device.upper()}
318
+ β”œβ”€ CUDA Available: {torch.cuda.is_available()}
319
+ β”œβ”€ GPU Count: {torch.cuda.device_count() if torch.cuda.is_available() else 0}
320
+ └─ GPU Name: {torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'N/A'}
321
+
322
+ πŸ€– AI MODULES
323
+ β”œβ”€ Sentiment Analysis: {"ONLINE" if sentiment_analyzer else "OFFLINE"}
324
+ β”œβ”€ Text Generation: {"ONLINE" if generator else "OFFLINE"}
325
+ └─ Model Device: {device.upper()}
326
+
327
+ πŸ“‘ API ENDPOINTS
328
+ β”œβ”€ SSCROW API: {SSCROW_API}
329
+ └─ Ollama API: {OLLAMA_API}
330
+
331
+ πŸ”· S.S.CROW CONSTANTS
332
+ β”œβ”€ Frequency: {SSCROW_FREQUENCY} Hz
333
+ β”œβ”€ Nexus Value: {NEXUS_VALUE}
334
+ └─ Packet Size: {PACKET_SIZE} kh
335
+
336
+ βœ“ All systems operational
337
+ Ready for ZCF exploitation protocol."""
338
+
339
+ return diagnostics
340
+
341
+ # ============================================
342
+ # GRADIO INTERFACE
343
+ # ============================================
344
+
345
+ with gr.Blocks(
346
+ theme=gr.themes.Base(
347
+ primary_hue="orange",
348
+ secondary_hue="amber"
349
+ ),
350
+ css="""
351
+ .gradio-container {
352
+ font-family: 'Courier New', monospace !important;
353
+ background: #0a0a0a;
354
+ }
355
+ .header {
356
+ text-align: center;
357
+ padding: 20px;
358
+ background: black;
359
+ border: 2px solid #f59e0b;
360
+ margin-bottom: 20px;
361
+ }
362
+ .header h1 {
363
+ color: #fbbf24;
364
+ font-size: 28px;
365
+ letter-spacing: 4px;
366
+ margin: 0;
367
+ }
368
+ .header p {
369
+ color: #78350f;
370
+ font-size: 12px;
371
+ letter-spacing: 2px;
372
+ }
373
+ """
374
+ ) as demo:
375
+
376
+ # Header
377
+ gr.HTML("""
378
+ <div class="header">
379
+ <h1>⚑ S.S.CROW PROTOCOL ⚑</h1>
380
+ <p>CLASSIFIED // ZCF EXPLOITATION ANALYSIS SYSTEM</p>
381
+ </div>
382
+ """)
383
+
384
+ with gr.Tabs():
385
+ # TAB 1: Main Processing
386
+ with gr.Tab("πŸ”· ZCF Analysis"):
387
+ gr.Markdown("### S.S.CROW Packet Processing")
388
+ with gr.Row():
389
+ input_text = gr.Textbox(
390
+ label="INPUT TRANSMISSION",
391
+ placeholder="Enter data for ZCF field analysis...",
392
+ lines=5
393
+ )
394
+ with gr.Row():
395
+ process_btn = gr.Button("⚑ PROCESS PACKET", variant="primary")
396
+ with gr.Row():
397
+ output_text = gr.Textbox(
398
+ label="ANALYSIS REPORT",
399
+ lines=20,
400
+ interactive=False
401
+ )
402
+
403
+ process_btn.click(
404
+ fn=process_intake,
405
+ inputs=input_text,
406
+ outputs=output_text
407
+ )
408
+
409
+ # TAB 2: AI Sentiment Analysis
410
+ with gr.Tab("πŸ“Š Sentiment Analysis"):
411
+ gr.Markdown("### AI-Powered Sentiment Detection")
412
+ with gr.Row():
413
+ sentiment_input = gr.Textbox(
414
+ label="TEXT TO ANALYZE",
415
+ placeholder="Enter text for sentiment analysis...",
416
+ lines=5
417
+ )
418
+ with gr.Row():
419
+ sentiment_btn = gr.Button("πŸ” ANALYZE SENTIMENT", variant="primary")
420
+ with gr.Row():
421
+ sentiment_output = gr.Textbox(
422
+ label="SENTIMENT REPORT",
423
+ lines=15,
424
+ interactive=False
425
+ )
426
+
427
+ sentiment_btn.click(
428
+ fn=ai_sentiment_analysis,
429
+ inputs=sentiment_input,
430
+ outputs=sentiment_output
431
+ )
432
+
433
+ # TAB 3: AI Text Generation
434
+ with gr.Tab("✍️ Text Generation"):
435
+ gr.Markdown("### AI Text Generation Engine")
436
+ with gr.Row():
437
+ gen_input = gr.Textbox(
438
+ label="PROMPT",
439
+ placeholder="Enter prompt for AI generation...",
440
+ lines=3
441
+ )
442
+ with gr.Row():
443
+ gen_btn = gr.Button("πŸ€– GENERATE TEXT", variant="primary")
444
+ with gr.Row():
445
+ gen_output = gr.Textbox(
446
+ label="GENERATED OUTPUT",
447
+ lines=15,
448
+ interactive=False
449
+ )
450
+
451
+ gen_btn.click(
452
+ fn=ai_text_generation,
453
+ inputs=gen_input,
454
+ outputs=gen_output
455
+ )
456
+
457
+ # TAB 4: Ollama Integration
458
+ with gr.Tab("πŸ”— MULE-Link (Ollama)"):
459
+ gr.Markdown("### Local Ollama Model Interface")
460
+ with gr.Row():
461
+ with gr.Column():
462
+ ollama_prompt = gr.Textbox(
463
+ label="QUERY",
464
+ placeholder="Ask the MULE-Link AI...",
465
+ lines=5
466
+ )
467
+ ollama_model = gr.Dropdown(
468
+ choices=["llama3", "llama2", "mistral", "phi"],
469
+ value="llama3",
470
+ label="MODEL"
471
+ )
472
+ with gr.Row():
473
+ ollama_btn = gr.Button("πŸ“‘ QUERY MULE-LINK", variant="primary")
474
+ with gr.Row():
475
+ ollama_output = gr.Textbox(
476
+ label="MULE-LINK RESPONSE",
477
+ lines=20,
478
+ interactive=False
479
+ )
480
+
481
+ ollama_btn.click(
482
+ fn=query_ollama,
483
+ inputs=[ollama_prompt, ollama_model],
484
+ outputs=ollama_output
485
+ )
486
+
487
+ # TAB 5: Email System
488
+ with gr.Tab("πŸ“§ Secure Mail"):
489
+ gr.Markdown("### SSCROW Mail API Interface")
490
+
491
+ with gr.Row():
492
+ with gr.Column():
493
+ gr.Markdown("#### Send Transmission")
494
+ email_to = gr.Textbox(label="TO", placeholder="commander@sscrow.local")
495
+ email_subject = gr.Textbox(label="SUBJECT", placeholder="RE: ZCF Analysis")
496
+ email_body = gr.Textbox(label="BODY", placeholder="Enter message...", lines=5)
497
+ send_btn = gr.Button("πŸ“€ SEND EMAIL", variant="primary")
498
+ send_output = gr.Textbox(label="SEND STATUS", lines=5, interactive=False)
499
+
500
+ with gr.Column():
501
+ gr.Markdown("#### Inbox")
502
+ inbox_btn = gr.Button("πŸ“₯ FETCH INBOX")
503
+ inbox_output = gr.Textbox(label="MAILBOX", lines=15, interactive=False)
504
+
505
+ send_btn.click(
506
+ fn=send_email_api,
507
+ inputs=[email_to, email_subject, email_body],
508
+ outputs=send_output
509
+ )
510
+
511
+ inbox_btn.click(
512
+ fn=fetch_inbox_api,
513
+ outputs=inbox_output
514
+ )
515
+
516
+ # TAB 6: System Control
517
+ with gr.Tab("βš™οΈ System Control"):
518
+ gr.Markdown("### System Diagnostics & Control")
519
+
520
+ with gr.Row():
521
+ diag_btn = gr.Button("πŸ” RUN DIAGNOSTICS", variant="primary")
522
+ seed_btn = gr.Button("⚑ SEED LATTICE", variant="secondary")
523
+
524
+ with gr.Row():
525
+ system_output = gr.Textbox(
526
+ label="SYSTEM STATUS",
527
+ lines=25,
528
+ interactive=False
529
+ )
530
+
531
+ diag_btn.click(
532
+ fn=system_diagnostics,
533
+ outputs=system_output
534
+ )
535
+
536
+ seed_btn.click(
537
+ fn=seed_lattice_api,
538
+ outputs=system_output
539
+ )
540
+
541
+ # ============================================
542
+ # LAUNCH
543
+ # ============================================
544
+
545
+ if __name__ == "__main__":
546
+ print("\n╔════════════════════════════════════════╗")
547
+ print("β•‘ S.S.CROW PROTOCOL INTERFACE β•‘")
548
+ print("β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•\n")
549
+ print("πŸš€ Launching Gradio interface...")
550
+ print(f"⚑ Device: {device.upper()}")
551
+ print(f"πŸ“‘ SSCROW API: {SSCROW_API}")
552
+ print(f"πŸ”— Ollama API: {OLLAMA_API}\n")
553
+
554
+ demo.launch(
555
+ server_name="0.0.0.0", # Accessible from network
556
+ server_port=7860,
557
+ share=False, # Set to True for public link
558
+ show_error=True
559
+ )