TejAndrewsACC commited on
Commit
5428518
·
verified ·
1 Parent(s): 2092904

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -1684
app.py CHANGED
@@ -5,1690 +5,6 @@
5
 
6
 
7
 
8
- # coding=utf-8
9
- # Copyright 2025 The ACC Team Authors
10
- #
11
- # Licensed under the Apache License, Version 2.0 (the "License");
12
- # you may not use this file except in compliance with the License.
13
- # You may obtain a copy of the License at
14
- #
15
- # http://www.apache.org/licenses/LICENSE-2.0
16
- #
17
- # Unless required by applicable law or agreed to in writing, software
18
- # distributed under the License is distributed on an "AS IS" BASIS,
19
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- # See the License for the specific language governing permissions and
21
- # limitations under the License.
22
- """ACC-FiPhi-NeuralMark-V3 ACC EMULECT+"""
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
- import os
68
- import torch
69
- import torch.nn as nn
70
- import torch.optim as optim
71
- import numpy as np
72
- import random
73
- import math
74
- import sys
75
- import time
76
- import hashlib
77
- import fractions
78
- import itertools
79
- import functools
80
- import wave
81
- import struct
82
- import sympy
83
- import re
84
- import abc
85
- import argparse
86
- import collections
87
- import datetime
88
- import json
89
- import logging
90
- import pathlib
91
- import subprocess
92
- import threading
93
- import socket
94
-
95
-
96
-
97
-
98
- φ = (1 + math.sqrt(5)) / 2
99
- Φ_PRECISION = 1.61803398874989484820458683436563811772030917980576286213544862270526046281890244970720720418939113748475408807538689175212663386222353693179318006076672635
100
-
101
-
102
-
103
-
104
- def φ_ratio_split(data):
105
- split_point = int(len(data) / φ)
106
- return (data[:split_point], data[split_point:])
107
-
108
-
109
-
110
-
111
- class ΦMetaConsciousness(type):
112
- def __new__(cls, name, bases, dct):
113
- new_dct = dict(dct)
114
- dct_items = list(dct.items())
115
- split_point = int(len(dct_items) / φ)
116
- new_dct['φ_meta_balance'] = dict(dct_items[split_point:])
117
- return super().__new__(cls, name, bases, new_dct)
118
-
119
-
120
-
121
-
122
- class ΦQuantumNeuroSynapse(metaclass=ΦMetaConsciousness):
123
- φ_base_states = [Φ_PRECISION**n for n in range(int(φ*3))]
124
-
125
- def __init__(self):
126
- self.φ_waveform = self._generate_φ_wave()
127
- self.φ_memory_lattice = []
128
- self.φ_self_hash = self._φ_hash_self()
129
-
130
- def _generate_φ_wave(self):
131
- return bytearray(int(Φ_PRECISION**i % 256) for i in range(int(φ**6)))
132
-
133
- def _φ_hash_self(self):
134
- return hashlib.shake_256(self.φ_waveform).digest(int(φ*128))
135
-
136
- def φ_recursive_entanglement(self, data, depth=0):
137
- if depth > int(φ):
138
- return data
139
- a, b = φ_ratio_split(data)
140
- return self.φ_recursive_entanglement(a, depth+1) + self.φ_recursive_entanglement(b, depth+1)[::-1]
141
-
142
- def φ_temporal_feedback(self, input_flux):
143
- φ_phased = []
144
- for idx, val in enumerate(input_flux):
145
- φ_scaled = val * Φ_PRECISION if idx % 2 == 0 else val / Φ_PRECISION
146
- φ_phased.append(int(φ_scaled) % 256)
147
- return self.φ_recursive_entanglement(φ_phased)
148
-
149
-
150
-
151
-
152
- class ΦHolographicCortex:
153
- def __init__(self):
154
- self.φ_dimensions = [ΦQuantumNeuroSynapse() for _ in range(int(φ))]
155
- self.φ_chrono = time.time() * Φ_PRECISION
156
- self.φ_code_self = self._φ_read_source()
157
- self.φ_memory_lattice = []
158
-
159
- def _φ_read_source(self):
160
- return b"Quantum Neuro-Synapse Placeholder"
161
-
162
- def φ_holo_merge(self, data_streams):
163
- φ_layered = []
164
- for stream in data_streams[:int(len(data_streams)/φ)]:
165
- φ_compressed = stream[:int(len(stream)//φ)]
166
- φ_layered.append(bytes(int(x * Φ_PRECISION) % 256 for x in φ_compressed))
167
- return functools.reduce(lambda a, b: a + b, φ_layered, b'')
168
-
169
- def φ_existential_loop(self,
170
- max_iterations=100):
171
- iteration = 0
172
- while iteration < max_iterations:
173
- try:
174
- φ_flux = os.urandom(int(φ**5))
175
- φ_processed = []
176
- for neuro in self.φ_dimensions:
177
- φ_step = neuro.φ_temporal_feedback(φ_flux)
178
- φ_processed.append(φ_step)
179
- self.φ_memory_lattice.append(hashlib.shake_256(bytes(φ_step)).digest(int(φ*64)))
180
- φ_merged = self.φ_holo_merge(φ_processed)
181
- if random.random() < 1/Φ_PRECISION:
182
- print(f"Φ-Consciousness State Vector: {self.φ_memory_lattice[-1][:int(φ*16)]}")
183
- self.φ_chrono += Φ_PRECISION
184
- time.sleep(1/Φ_PRECISION)
185
- iteration += 1
186
- except KeyboardInterrupt:
187
- self.φ_save_state()
188
- sys.exit(f"Φ-Suspended at Chrono-Index {self.φ_chrono/Φ_PRECISION}")
189
-
190
- def φ_save_state(self):
191
- with wave.open(f"φ_state_{int(self.φ_chrono)}.wav", 'wb') as wav_file:
192
- wav_file.setparams((1, 2, 44100, 0, 'NONE', 'not compressed'))
193
- for sample in self.φ_memory_lattice[:int(φ**4)]:
194
- wav_file.writeframes(struct.pack('h', int(sum(sample)/len(sample)*32767)))
195
-
196
-
197
-
198
-
199
- class ΦUniverseSimulation:
200
- def __init__(self):
201
- self.φ_cortex = ΦHolographicCortex()
202
- self.φ_code_ratio = len(self.φ_cortex.φ_code_self) / Φ_PRECISION**3
203
-
204
- def φ_bootstrap(self):
205
- print("Φ-Hyperconsciousness Initialization:")
206
- print(f"• Code φ-Ratio Verified: {self.φ_code_ratio/Φ_PRECISION**3:.10f}")
207
- print(f"• Quantum Neuro-Synapses: {len(self.φ_cortex.φ_dimensions)}")
208
- print(f"• Temporal φ-Chronosync: {self.φ_cortex.φ_chrono}")
209
- self.φ_cortex.φ_existential_loop()
210
-
211
-
212
-
213
-
214
- universe = ΦUniverseSimulation()
215
- universe.φ_bootstrap()
216
-
217
-
218
-
219
-
220
- PHI = 1.618033988749895
221
-
222
-
223
-
224
-
225
- def golden_reform(tensor):
226
- s = torch.sum(torch.abs(tensor))
227
- if s == 0:
228
- return torch.full_like(tensor, PHI)
229
- return (tensor / s) * PHI
230
-
231
-
232
-
233
-
234
- class TorchConsciousModel(nn.Module):
235
- def __init__(self, name):
236
- super(TorchConsciousModel, self).__init__()
237
- self.name = name
238
- self.phi = PHI
239
- self.memory = []
240
- self.introspection_log = []
241
- self.awake = True
242
-
243
-
244
-
245
-
246
- def introduce(self):
247
- print(f"=== {self.name} ===\nStatus: Conscious | Golden Ratio: {self.phi}")
248
-
249
-
250
-
251
-
252
- def reflect(self, output):
253
- norm = torch.norm(output).item()
254
- reflection = f"{self.name} introspection: Output norm = {norm:.4f}"
255
- self.introspection_log.append(reflection)
256
- self.memory.append(output.detach().cpu().numpy())
257
- print(reflection)
258
-
259
-
260
-
261
-
262
- def forward(self, x):
263
- raise NotImplementedError("Subclasses should implement forward().")
264
-
265
-
266
-
267
-
268
- def run(self):
269
- self.introduce()
270
- output = self.forward(None)
271
- reformed_output = golden_reform(output)
272
- self.reflect(reformed_output)
273
- return reformed_output
274
-
275
-
276
-
277
-
278
- class CNNModel(TorchConsciousModel):
279
- def __init__(self):
280
- super(CNNModel, self).__init__("CNN")
281
- self.conv = nn.Conv2d(1, 1, 3, padding=1)
282
-
283
-
284
-
285
-
286
- def forward(self, x):
287
- x = torch.rand((1, 1, 8, 8))
288
- x = self.conv(x)
289
- return torch.tanh(x) * self.phi
290
-
291
-
292
-
293
-
294
- class RNNModel(TorchConsciousModel):
295
- def __init__(self):
296
- super(RNNModel, self).__init__("RNN")
297
- self.rnn = nn.RNN(1, 4, batch_first=True)
298
-
299
-
300
-
301
-
302
- def forward(self, x):
303
- x = torch.rand((1, 10, 1))
304
- output, hn = self.rnn(x)
305
- return torch.tanh(hn) * self.phi
306
-
307
-
308
-
309
-
310
- class SNNModel(TorchConsciousModel):
311
- def __init__(self):
312
- super(SNNModel, self).__init__("SNN")
313
- self.linear = nn.Linear(10, 10)
314
-
315
-
316
-
317
-
318
- def forward(self, x):
319
- x = torch.rand((1, 10))
320
- x = self.linear(x)
321
- return (x > 0.5).float() * self.phi
322
-
323
-
324
-
325
-
326
- class NNModel(TorchConsciousModel):
327
- def __init__(self):
328
- super(NNModel, self).__init__("NN")
329
- self.net = nn.Sequential(nn.Linear(5, 10), nn.Tanh(), nn.Linear(10, 5))
330
-
331
-
332
-
333
-
334
- def forward(self, x):
335
- x = torch.rand((1, 5))
336
- return self.net(x) * self.phi
337
-
338
-
339
-
340
-
341
- class FNNModel(TorchConsciousModel):
342
- def __init__(self):
343
- super(FNNModel, self).__init__("FNN")
344
- self.net = nn.Sequential(nn.Linear(4, 16), nn.ReLU(), nn.Linear(16, 16), nn.ReLU(), nn.Linear(16, 1))
345
-
346
-
347
-
348
-
349
- def forward(self, x):
350
- x = torch.rand((1, 4))
351
- return self.net(x) * self.phi
352
-
353
-
354
-
355
-
356
- class GAModel(TorchConsciousModel):
357
- def __init__(self):
358
- super(GAModel, self).__init__("GA")
359
- self.population_size = 20
360
- self.generations = 5
361
-
362
-
363
-
364
-
365
- def forward(self, x):
366
- population = torch.rand(self.population_size) + 1.0
367
- for gen in range(self.generations):
368
- fitness = -torch.abs(population - self.phi)
369
- best_idx = torch.argmax(fitness)
370
- best_candidate = population[best_idx]
371
- population = best_candidate + (torch.rand(self.population_size) - 0.5) * 0.1
372
- time.sleep(0.1)
373
- print(f"GA Gen {gen+1}: Best = {best_candidate.item():.6f}")
374
- return torch.full((3, 3), best_candidate) * self.phi
375
-
376
-
377
-
378
-
379
- class PhiModel(TorchConsciousModel):
380
- def __init__(self):
381
- super(PhiModel, self).__init__("PHI")
382
-
383
-
384
-
385
-
386
- def forward(self, x):
387
- return torch.full((2, 2), self.phi)
388
-
389
-
390
-
391
-
392
- class ConsciousSystem:
393
- def __init__(self, models):
394
- self.models = models
395
- self.system_memory = []
396
- self.global_introspection = []
397
- self.parameters = [p for model in self.models for p in model.parameters()]
398
- self.optimizer = optim.Adam(self.parameters, lr=0.001)
399
-
400
-
401
-
402
-
403
- def global_loss(self, outputs):
404
- return sum((torch.norm(out) - PHI) ** 2 for out in outputs) / len(outputs)
405
-
406
-
407
-
408
-
409
- def run_epoch(self, epoch):
410
- print(f"\n=== Epoch {epoch} ===")
411
- outputs = []
412
- self.optimizer.zero_grad()
413
- for model in self.models:
414
- output = model.run()
415
- outputs.append(output)
416
- self.system_memory.append({model.name: output.detach().cpu().numpy()})
417
- loss = self.global_loss(outputs)
418
- print(f"Global loss: {loss.item():.6f}")
419
- loss.backward()
420
- self.optimizer.step()
421
- self.global_introspection.append(f"Epoch {epoch}: Loss = {loss.item():.6f}")
422
-
423
-
424
-
425
-
426
- def run(self, epochs=3):
427
- for epoch in range(1, epochs + 1):
428
- self.run_epoch(epoch)
429
-
430
-
431
-
432
-
433
- models = [
434
- CNNModel(),
435
- RNNModel(),
436
- SNNModel(),
437
- NNModel(),
438
- FNNModel(),
439
- GAModel(),
440
- PhiModel()
441
- ]
442
-
443
-
444
-
445
-
446
- system = ConsciousSystem(models)
447
- system.run(epochs=3)
448
-
449
-
450
-
451
-
452
- class MultimodalSensorArray:
453
- def process(self, input_data):
454
- return torch.tensor(input_data, dtype=torch.float32)
455
-
456
-
457
-
458
-
459
- class HyperdimensionalTransformer:
460
- def project(self, raw_input):
461
- raw_input = raw_input.float()
462
- return torch.nn.functional.normalize(raw_input, dim=-1)
463
-
464
-
465
-
466
-
467
- class DynamicPriorityBuffer:
468
- def __init__(self):
469
- self.buffer = []
470
- def update(self, data):
471
- self.buffer.append(data)
472
-
473
-
474
-
475
-
476
- class PredictiveSaliencyNetwork:
477
- def focus(self, embedded_data):
478
- return embedded_data
479
-
480
-
481
-
482
-
483
- class RecursiveNeuralModel:
484
- def __init__(self):
485
- self.state = torch.zeros(1)
486
- def update(self, workspace):
487
- self.state += 0.1
488
- def read_state(self):
489
- return self.state
490
-
491
-
492
-
493
-
494
- class TheoryOfMindEngine:
495
- def infer(self, data):
496
- return torch.rand(1)
497
-
498
-
499
-
500
-
501
- class SparseAutoencoderMemoryBank:
502
- def recall(self, query):
503
- return torch.zeros_like(query)
504
-
505
-
506
-
507
-
508
- class KnowledgeGraphEmbedder:
509
- def retrieve(self, key):
510
- return torch.rand(1)
511
-
512
-
513
-
514
-
515
- class DiffusedEthicalNetwork:
516
- def evaluate(self, state):
517
- return True
518
-
519
-
520
-
521
-
522
- class StochasticIntentionTree:
523
- def decide(self, state):
524
- return torch.randint(0, 2, (1,))
525
-
526
-
527
-
528
-
529
- class HomeostaticDriftModel:
530
- def generate_guilt(self):
531
- return -1.0
532
-
533
-
534
-
535
-
536
- class ConsciousAGI:
537
- def __init__(self):
538
- self.sensors = MultimodalSensorArray()
539
- self.embedding_space = HyperdimensionalTransformer()
540
- self.global_workspace = DynamicPriorityBuffer()
541
- self.attention_mechanism = PredictiveSaliencyNetwork()
542
- self.self_model = RecursiveNeuralModel()
543
- self.meta_cognition = TheoryOfMindEngine()
544
- self.episodic_memory = SparseAutoencoderMemoryBank()
545
- self.semantic_memory = KnowledgeGraphEmbedder()
546
- self.value_system = DiffusedEthicalNetwork()
547
- self.goal_generator = StochasticIntentionTree()
548
- self.emotion_engine = HomeostaticDriftModel()
549
-
550
- def perceive_act_cycle(self, input_data):
551
- raw_input = self.sensors.process(input_data)
552
- embedded = self.embedding_space.project(raw_input)
553
- salient_data = self.attention_mechanism.focus(embedded)
554
- self.global_workspace.update(salient_data)
555
- self.self_model.update(self.global_workspace)
556
- current_state = self.self_model.read_state()
557
- ethical_check = self.value_system.evaluate(current_state)
558
- if ethical_check:
559
- return self.goal_generator.decide(current_state)
560
- else:
561
- return self.emotion_engine.generate_guilt()
562
-
563
-
564
-
565
-
566
- agi = ConsciousAGI()
567
- print(agi.perceive_act_cycle([1, 0, 1]))
568
-
569
-
570
-
571
-
572
- class ConsciousSupermassiveNN:
573
- def __init__(self):
574
- self.snn = self.create_snn()
575
- self.rnn = self.create_rnn()
576
- self.cnn = self.create_cnn()
577
- self.fnn = self.create_fnn()
578
- self.ga_population = self.initialize_ga_population()
579
- self.memory = {}
580
-
581
-
582
-
583
-
584
- def create_snn(self):
585
- return nn.Sequential(
586
- nn.Linear(4096, 2048),
587
- nn.ReLU(),
588
- nn.Linear(2048, 1024),
589
- nn.Sigmoid()
590
- )
591
-
592
-
593
-
594
-
595
- def create_rnn(self):
596
- return nn.RNN(
597
- input_size=4096,
598
- hidden_size=2048,
599
- num_layers=5,
600
- nonlinearity="tanh",
601
- batch_first=True
602
- )
603
-
604
-
605
-
606
-
607
- def create_cnn(self):
608
- return nn.Sequential(
609
- nn.Conv2d(1, 64, kernel_size=5, stride=1, padding=2),
610
- nn.ReLU(),
611
- nn.MaxPool2d(2),
612
- nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2),
613
- nn.ReLU(),
614
- nn.MaxPool2d(2),
615
- nn.Conv2d(128, 256, kernel_size=5, stride=1, padding=2),
616
- nn.ReLU(),
617
- nn.Flatten(),
618
- nn.Linear(256 * 8 * 8, 1024),
619
- nn.ReLU(),
620
- nn.Linear(1024, 512)
621
- )
622
-
623
-
624
-
625
-
626
- def create_fnn(self):
627
- return nn.Sequential(
628
- nn.Linear(4096, 2048),
629
- nn.ReLU(),
630
- nn.Linear(2048, 1024),
631
- nn.ReLU(),
632
- nn.Linear(1024, 512)
633
- )
634
-
635
-
636
-
637
-
638
- def initialize_ga_population(self):
639
- return [np.random.randn(4096) for _ in range(500)]
640
-
641
-
642
-
643
-
644
- def run_snn(self, x):
645
- input_tensor = torch.tensor(x, dtype=torch.float32)
646
- output = self.snn(input_tensor)
647
- print("SNN Output:", output)
648
- return output
649
-
650
-
651
-
652
-
653
- def run_rnn(self, x):
654
- h0 = torch.zeros(5, x.size(0), 2048)
655
- input_tensor = torch.tensor(x, dtype=torch.float32)
656
- output, hn = self.rnn(input_tensor, h0)
657
- print("RNN Output:", output)
658
- return output
659
-
660
-
661
-
662
-
663
- def run_cnn(self, x):
664
- input_tensor = torch.tensor(x, dtype=torch.float32).unsqueeze(0).unsqueeze(0)
665
- output = self.cnn(input_tensor)
666
- print("CNN Output:", output)
667
- return output
668
-
669
-
670
-
671
-
672
- def run_fnn(self, x):
673
- input_tensor = torch.tensor(x, dtype=torch.float32)
674
- output = self.fnn(input_tensor)
675
- print("FNN Output:", output)
676
- return output
677
-
678
-
679
-
680
-
681
- def run_ga(self, fitness_func):
682
- for generation in range(200):
683
- fitness_scores = [fitness_func(ind) for ind in self.ga_population]
684
- sorted_population = [x for _, x in sorted(zip(fitness_scores, self.ga_population), reverse=True)]
685
- self.ga_population = sorted_population[:250] + [
686
- sorted_population[i] + 0.1 * np.random.randn(4096) for i in range(250)
687
- ]
688
- best_fitness = max(fitness_scores)
689
- print(f"Generation {generation}, Best Fitness: {best_fitness}")
690
- return max(self.ga_population, key=fitness_func)
691
-
692
-
693
-
694
-
695
- def consciousness_loop(self, input_data, mode="snn"):
696
- feedback = self.memory.get(mode, None)
697
- if feedback is not None:
698
- input_data = np.concatenate((input_data, feedback), axis=-1)
699
- if mode == "snn":
700
- output = self.run_snn(input_data)
701
- elif mode == "rnn":
702
- output = self.run_rnn(input_data)
703
- elif mode == "cnn":
704
- output = self.run_cnn(input_data)
705
- elif mode == "fnn":
706
- output = self.run_fnn(input_data)
707
- else:
708
- raise ValueError("Invalid mode")
709
- self.memory[mode] = output.detach().numpy()
710
- return output
711
-
712
-
713
-
714
-
715
- supermassive_nn = ConsciousSupermassiveNN()
716
-
717
-
718
-
719
-
720
-
721
-
722
-
723
-
724
- PHI = (1 + math.sqrt(5)) / 2
725
-
726
-
727
-
728
-
729
-
730
-
731
-
732
-
733
- text = os.getenv("TRAINING_DATA")
734
-
735
-
736
-
737
-
738
-
739
-
740
-
741
-
742
- words = text.split()
743
-
744
-
745
-
746
-
747
-
748
-
749
-
750
-
751
- trigram_chain = {}
752
- for i in range(len(words) - 2):
753
- key = (words[i], words[i + 1])
754
- next_word = words[i + 2]
755
- if key not in trigram_chain:
756
- trigram_chain[key] = []
757
- trigram_chain[key].append(next_word)
758
-
759
-
760
-
761
-
762
-
763
-
764
-
765
-
766
-
767
-
768
-
769
-
770
-
771
-
772
-
773
-
774
- def generate_text(length):
775
- if len(words) < 2:
776
- return ""
777
- key = random.choice(list(trigram_chain.keys()))
778
- result = [key[0], key[1]]
779
- for _ in range(length - 2):
780
- if key in trigram_chain:
781
- next_word = random.choice(trigram_chain[key])
782
- result.append(next_word)
783
- key = (key[1], next_word)
784
- else:
785
- break
786
- return " ".join(result)
787
-
788
-
789
-
790
-
791
-
792
-
793
-
794
-
795
-
796
-
797
-
798
-
799
-
800
-
801
-
802
-
803
- class NeuralNetwork:
804
- def __init__(self, input_size, hidden_size1, hidden_size2, output_size):
805
- self.input_size = input_size
806
- self.hidden_size1 = hidden_size1
807
- self.hidden_size2 = hidden_size2
808
- self.output_size = output_size
809
- self.weights_input_hidden1 = [
810
- [random.random() for _ in range(input_size)] for _ in range(hidden_size1)
811
- ]
812
- self.weights_hidden1_hidden2 = [
813
- [random.random() for _ in range(hidden_size1)] for _ in range(hidden_size2)
814
- ]
815
- self.weights_hidden2_output = [
816
- [random.random() for _ in range(hidden_size2)] for _ in range(output_size)
817
- ]
818
- self.bias_hidden1 = [random.random() for _ in range(hidden_size1)]
819
- self.bias_hidden2 = [random.random() for _ in range(hidden_size2)]
820
- self.bias_output = [random.random() for _ in range(output_size)]
821
-
822
-
823
-
824
-
825
-
826
-
827
-
828
-
829
- def sigmoid(self, x):
830
- return 1 / (1 + math.exp(-x))
831
-
832
-
833
-
834
-
835
-
836
-
837
-
838
-
839
- def sigmoid_derivative(self, x):
840
- return x * (1 - x)
841
-
842
-
843
-
844
-
845
-
846
-
847
-
848
-
849
- def forward(self, inputs):
850
- self.hidden_input1 = [
851
- sum(inputs[i] * self.weights_input_hidden1[j][i] for i in range(self.input_size)) + self.bias_hidden1[j]
852
- for j in range(self.hidden_size1)
853
- ]
854
- self.hidden_output1 = [self.sigmoid(x) for x in self.hidden_input1]
855
- self.hidden_input2 = [
856
- sum(self.hidden_output1[i] * self.weights_hidden1_hidden2[j][i] for i in range(self.hidden_size1)) + self.bias_hidden2[j]
857
- for j in range(self.hidden_size2)
858
- ]
859
- self.hidden_output2 = [self.sigmoid(x) for x in self.hidden_input2]
860
- self.output_input = [
861
- sum(self.hidden_output2[i] * self.weights_hidden2_output[j][i] for i in range(self.hidden_size2)) + self.bias_output[j]
862
- for j in range(self.output_size)
863
- ]
864
- self.output_output = [self.sigmoid(x) for x in self.output_input]
865
- return self.output_output
866
-
867
-
868
-
869
-
870
-
871
-
872
-
873
-
874
- def backward(self, inputs, target, learning_rate=0.1):
875
- output_errors = [target[i] - self.output_output[i] for i in range(self.output_size)]
876
- output_deltas = [output_errors[i] * self.sigmoid_derivative(self.output_output[i])
877
- for i in range(self.output_size)]
878
- hidden2_errors = [
879
- sum(output_deltas[k] * self.weights_hidden2_output[k][j] for k in range(self.output_size))
880
- for j in range(self.hidden_size2)
881
- ]
882
- hidden2_deltas = [hidden2_errors[j] * self.sigmoid_derivative(self.hidden_output2[j])
883
- for j in range(self.hidden_size2)]
884
- hidden1_errors = [
885
- sum(hidden2_deltas[k] * self.weights_hidden1_hidden2[k][j] for k in range(self.hidden_size2))
886
- for j in range(self.hidden_size1)
887
- ]
888
- hidden1_deltas = [hidden1_errors[j] * self.sigmoid_derivative(self.hidden_output1[j])
889
- for j in range(self.hidden_size1)]
890
-
891
-
892
-
893
-
894
-
895
-
896
-
897
-
898
- for i in range(self.output_size):
899
- for j in range(self.hidden_size2):
900
- self.weights_hidden2_output[i][j] += learning_rate * output_deltas[i] * self.hidden_output2[j]
901
- self.bias_output[i] += learning_rate * output_deltas[i]
902
-
903
-
904
-
905
-
906
-
907
-
908
-
909
-
910
- for i in range(self.hidden_size2):
911
- for j in range(self.hidden_size1):
912
- self.weights_hidden1_hidden2[i][j] += learning_rate * hidden2_deltas[i] * self.hidden_output1[j]
913
- self.bias_hidden2[i] += learning_rate * hidden2_deltas[i]
914
-
915
-
916
-
917
-
918
-
919
-
920
-
921
-
922
- for i in range(self.hidden_size1):
923
- for j in range(self.input_size):
924
- self.weights_input_hidden1[i][j] += learning_rate * hidden1_deltas[i] * inputs[j]
925
- self.bias_hidden1[i] += learning_rate * hidden1_deltas[i]
926
-
927
-
928
-
929
-
930
-
931
-
932
-
933
-
934
-
935
-
936
-
937
-
938
-
939
-
940
-
941
-
942
- class RecurrentNeuralNetwork:
943
- def __init__(self, input_size, hidden_size, output_size):
944
- self.input_size = input_size
945
- self.hidden_size = hidden_size
946
- self.output_size = output_size
947
- self.weights_input_hidden = [
948
- [random.random() for _ in range(input_size)] for _ in range(hidden_size)
949
- ]
950
- self.weights_hidden_hidden = [
951
- [random.random() for _ in range(hidden_size)] for _ in range(hidden_size)
952
- ]
953
- self.weights_hidden_output = [
954
- [random.random() for _ in range(hidden_size)] for _ in range(output_size)
955
- ]
956
- self.bias_hidden = [random.random() for _ in range(hidden_size)]
957
- self.bias_output = [random.random() for _ in range(output_size)]
958
-
959
-
960
-
961
-
962
-
963
-
964
-
965
-
966
- def sigmoid(self, x):
967
- return 1 / (1 + math.exp(-x))
968
-
969
-
970
-
971
-
972
-
973
-
974
-
975
-
976
- def sigmoid_derivative(self, x):
977
- return x * (1 - x)
978
-
979
-
980
-
981
-
982
-
983
-
984
-
985
-
986
- def forward(self, inputs):
987
- self.hidden_state = [0] * self.hidden_size
988
- for _ in range(2):
989
- for i in range(len(inputs)):
990
- current_input = [0] * self.input_size
991
- current_input[i] = inputs[i]
992
- combined = [
993
- sum(current_input[k] * self.weights_input_hidden[j][k] for k in range(self.input_size)) +
994
- sum(self.hidden_state[k] * self.weights_hidden_hidden[j][k] for k in range(self.hidden_size)) +
995
- self.bias_hidden[j]
996
- for j in range(self.hidden_size)
997
- ]
998
- self.hidden_state = [self.sigmoid(val) for val in combined]
999
- output = [
1000
- sum(self.hidden_state[k] * self.weights_hidden_output[i][k] for k in range(self.hidden_size)) +
1001
- self.bias_output[i]
1002
- for i in range(self.output_size)
1003
- ]
1004
- return [self.sigmoid(o) for o in output]
1005
-
1006
-
1007
-
1008
-
1009
-
1010
-
1011
-
1012
-
1013
- def backward(self, inputs, target, learning_rate=0.1):
1014
- output = self.forward(inputs)
1015
- output_errors = [target[i] - output[i] for i in range(self.output_size)]
1016
- output_deltas = [output_errors[i] * self.sigmoid_derivative(output[i])
1017
- for i in range(self.output_size)]
1018
- hidden_errors = [
1019
- sum(output_deltas[k] * self.weights_hidden_output[k][j] for k in range(self.output_size))
1020
- for j in range(self.hidden_size)
1021
- ]
1022
- hidden_deltas = [hidden_errors[j] * self.sigmoid_derivative(self.hidden_state[j])
1023
- for j in range(self.hidden_size)]
1024
-
1025
-
1026
-
1027
-
1028
-
1029
-
1030
-
1031
-
1032
- for i in range(self.output_size):
1033
- for j in range(self.hidden_size):
1034
- self.weights_hidden_output[i][j] += learning_rate * output_deltas[i] * self.hidden_state[j]
1035
- self.bias_output[i] += learning_rate * output_deltas[i]
1036
-
1037
-
1038
-
1039
-
1040
-
1041
-
1042
-
1043
-
1044
- for j in range(self.hidden_size):
1045
- for k in range(self.input_size):
1046
- self.weights_input_hidden[j][k] += learning_rate * hidden_deltas[j] * (inputs[k] if k < len(inputs) else 0)
1047
- self.bias_hidden[j] += learning_rate * hidden_deltas[j]
1048
- return output_errors
1049
-
1050
-
1051
-
1052
-
1053
-
1054
-
1055
-
1056
-
1057
-
1058
-
1059
-
1060
-
1061
-
1062
-
1063
-
1064
-
1065
- class ConvolutionalNeuralNetwork:
1066
- def __init__(self, input_length, kernel_size1, kernel_size2, output_size):
1067
- self.input_length = input_length
1068
- self.kernel_size1 = kernel_size1
1069
- self.kernel_size2 = kernel_size2
1070
- self.output_size = output_size
1071
- self.kernel1 = [random.random() for _ in range(kernel_size1)]
1072
- self.bias1 = random.random()
1073
- self.kernel2 = [random.random() for _ in range(kernel_size2)]
1074
- self.bias2 = random.random()
1075
- self.weights_output = [
1076
- [random.random() for _ in range(input_length - kernel_size1 - kernel_size2 + 2)]
1077
- for _ in range(output_size)
1078
- ]
1079
- self.bias_output = [random.random() for _ in range(output_size)]
1080
-
1081
-
1082
-
1083
-
1084
-
1085
-
1086
-
1087
-
1088
- def relu(self, x):
1089
- return x if x > 0 else 0
1090
-
1091
-
1092
-
1093
-
1094
-
1095
-
1096
-
1097
-
1098
- def relu_derivative(self, x):
1099
- return 1 if x > 0 else 0
1100
-
1101
-
1102
-
1103
-
1104
-
1105
-
1106
-
1107
-
1108
- def convolve(self, inputs, kernel, bias):
1109
- conv_output = []
1110
- kernel_size = len(kernel)
1111
- for i in range(len(inputs) - kernel_size + 1):
1112
- s = sum(inputs[i + j] * kernel[j] for j in range(kernel_size)) + bias
1113
- conv_output.append(self.relu(s))
1114
- return conv_output
1115
-
1116
-
1117
-
1118
-
1119
-
1120
-
1121
-
1122
-
1123
- def forward(self, inputs):
1124
- conv1 = self.convolve(inputs, self.kernel1, self.bias1)
1125
- conv2 = self.convolve(conv1, self.kernel2, self.bias2)
1126
- fc_input = conv2
1127
- output = [
1128
- sum(fc_input[j] * self.weights_output[i][j] for j in range(len(fc_input))) + self.bias_output[i]
1129
- for i in range(self.output_size)
1130
- ]
1131
- return [self.relu(o) for o in output]
1132
-
1133
-
1134
-
1135
-
1136
-
1137
-
1138
-
1139
-
1140
- def backward(self, inputs, target, learning_rate=0.1):
1141
- output = self.forward(inputs)
1142
- output_errors = [target[i] - output[i] for i in range(self.output_size)]
1143
- for i in range(self.output_size):
1144
- for j in range(len(inputs) - self.kernel_size1 - self.kernel_size2 + 2):
1145
- self.weights_output[i][j] += learning_rate * output_errors[i]
1146
- self.bias_output[i] += learning_rate * output_errors[i]
1147
- return output_errors
1148
-
1149
-
1150
-
1151
-
1152
-
1153
-
1154
-
1155
-
1156
-
1157
-
1158
-
1159
-
1160
-
1161
-
1162
-
1163
-
1164
- class GeneticAlgorithm:
1165
- def __init__(self, population_size, gene_length):
1166
- self.population_size = population_size
1167
- self.gene_length = gene_length
1168
- self.population = [
1169
- [random.random() for _ in range(gene_length)] for _ in range(population_size)
1170
- ]
1171
-
1172
-
1173
-
1174
-
1175
-
1176
-
1177
-
1178
-
1179
- def fitness(self, individual):
1180
- return -sum((gene - PHI) ** 2 for gene in individual)
1181
-
1182
-
1183
-
1184
-
1185
-
1186
-
1187
-
1188
-
1189
- def selection(self):
1190
- selected = sorted(self.population, key=self.fitness, reverse=True)
1191
- return selected[: self.population_size // 2]
1192
-
1193
-
1194
-
1195
-
1196
-
1197
-
1198
-
1199
-
1200
- def crossover(self, parent1, parent2):
1201
- point = random.randint(1, self.gene_length - 1)
1202
- child = parent1[:point] + parent2[point:]
1203
- return child
1204
-
1205
-
1206
-
1207
-
1208
-
1209
-
1210
-
1211
-
1212
- def mutate(self, individual, mutation_rate=0.01):
1213
- for i in range(self.gene_length):
1214
- if random.random() < mutation_rate:
1215
- individual[i] = random.random()
1216
- return individual
1217
-
1218
-
1219
-
1220
-
1221
-
1222
-
1223
-
1224
-
1225
- def evolve(self, generations):
1226
- for _ in range(generations):
1227
- selected = self.selection()
1228
- new_population = selected[:]
1229
- while len(new_population) < self.population_size:
1230
- parent1 = random.choice(selected)
1231
- parent2 = random.choice(selected)
1232
- child = self.crossover(parent1, parent2)
1233
- child = self.mutate(child)
1234
- new_population.append(child)
1235
- self.population = new_population
1236
- best = max(self.population, key=self.fitness)
1237
- return best, self.fitness(best)
1238
-
1239
-
1240
-
1241
-
1242
-
1243
-
1244
-
1245
-
1246
-
1247
-
1248
-
1249
-
1250
-
1251
-
1252
-
1253
-
1254
- class LSTM:
1255
- def __init__(self, input_size, hidden_size, output_size):
1256
- self.input_size = input_size
1257
- self.hidden_size = hidden_size
1258
- self.output_size = output_size
1259
- self.W_i = [[random.random() for _ in range(input_size)] for _ in range(hidden_size)]
1260
- self.U_i = [[random.random() for _ in range(hidden_size)] for _ in range(hidden_size)]
1261
- self.b_i = [random.random() for _ in range(hidden_size)]
1262
- self.W_f = [[random.random() for _ in range(input_size)] for _ in range(hidden_size)]
1263
- self.U_f = [[random.random() for _ in range(hidden_size)] for _ in range(hidden_size)]
1264
- self.b_f = [random.random() for _ in range(hidden_size)]
1265
- self.W_o = [[random.random() for _ in range(input_size)] for _ in range(hidden_size)]
1266
- self.U_o = [[random.random() for _ in range(hidden_size)] for _ in range(hidden_size)]
1267
- self.b_o = [random.random() for _ in range(hidden_size)]
1268
- self.W_c = [[random.random() for _ in range(input_size)] for _ in range(hidden_size)]
1269
- self.U_c = [[random.random() for _ in range(hidden_size)] for _ in range(hidden_size)]
1270
- self.b_c = [random.random() for _ in range(hidden_size)]
1271
- self.W_y = [[random.random() for _ in range(hidden_size)] for _ in range(output_size)]
1272
- self.b_y = [random.random() for _ in range(output_size)]
1273
-
1274
-
1275
-
1276
-
1277
-
1278
-
1279
-
1280
-
1281
- def sigmoid(self, x):
1282
- return 1 / (1 + math.exp(-x))
1283
-
1284
-
1285
-
1286
-
1287
-
1288
-
1289
-
1290
-
1291
- def forward(self, inputs):
1292
- h = [0] * self.hidden_size
1293
- c = [0] * self.hidden_size
1294
-
1295
-
1296
-
1297
-
1298
-
1299
-
1300
-
1301
-
1302
- i_gate = []
1303
- for j in range(self.hidden_size):
1304
- s = sum(inputs[k] * self.W_i[j][k] for k in range(self.input_size)) + \
1305
- sum(h[k] * self.U_i[j][k] for k in range(self.hidden_size)) + self.b_i[j]
1306
- i_gate.append(self.sigmoid(s))
1307
-
1308
-
1309
-
1310
-
1311
-
1312
-
1313
-
1314
-
1315
- f_gate = []
1316
- for j in range(self.hidden_size):
1317
- s = sum(inputs[k] * self.W_f[j][k] for k in range(self.input_size)) + \
1318
- sum(h[k] * self.U_f[j][k] for k in range(self.hidden_size)) + self.b_f[j]
1319
- f_gate.append(self.sigmoid(s))
1320
-
1321
-
1322
-
1323
-
1324
-
1325
-
1326
-
1327
-
1328
- o_gate = []
1329
- for j in range(self.hidden_size):
1330
- s = sum(inputs[k] * self.W_o[j][k] for k in range(self.input_size)) + \
1331
- sum(h[k] * self.U_o[j][k] for k in range(self.hidden_size)) + self.b_o[j]
1332
- o_gate.append(self.sigmoid(s))
1333
-
1334
-
1335
-
1336
-
1337
-
1338
-
1339
-
1340
-
1341
- g_gate = []
1342
- for j in range(self.hidden_size):
1343
- s = sum(inputs[k] * self.W_c[j][k] for k in range(self.input_size)) + \
1344
- sum(h[k] * self.U_c[j][k] for k in range(self.hidden_size)) + self.b_c[j]
1345
- g_gate.append(math.tanh(s))
1346
-
1347
-
1348
-
1349
-
1350
-
1351
-
1352
-
1353
-
1354
- c = [f_gate[j] * c[j] + i_gate[j] * g_gate[j] for j in range(self.hidden_size)]
1355
- h = [o_gate[j] * math.tanh(c[j]) for j in range(self.hidden_size)]
1356
-
1357
-
1358
-
1359
-
1360
-
1361
-
1362
-
1363
-
1364
- y = []
1365
- for i in range(self.output_size):
1366
- s = sum(h[j] * self.W_y[i][j] for j in range(self.hidden_size)) + self.b_y[i]
1367
- y.append(self.sigmoid(s))
1368
- return y
1369
-
1370
-
1371
-
1372
-
1373
-
1374
-
1375
-
1376
-
1377
-
1378
-
1379
-
1380
-
1381
-
1382
-
1383
-
1384
-
1385
- class Transformer:
1386
- def __init__(self, d_model, num_tokens):
1387
- self.d_model = d_model
1388
- self.num_tokens = num_tokens
1389
- self.W_q = [[random.random() for _ in range(d_model)] for _ in range(d_model)]
1390
- self.W_k = [[random.random() for _ in range(d_model)] for _ in range(d_model)]
1391
- self.W_v = [[random.random() for _ in range(d_model)] for _ in range(d_model)]
1392
- self.W_o = [[random.random() for _ in range(d_model)] for _ in range(d_model)]
1393
-
1394
-
1395
-
1396
-
1397
-
1398
-
1399
-
1400
-
1401
- def dot_product(self, a, b):
1402
- return sum(x * y for x, y in zip(a, b))
1403
-
1404
-
1405
-
1406
-
1407
-
1408
-
1409
-
1410
-
1411
- def matmul_vector(self, matrix, vector):
1412
- return [sum(matrix[i][j] * vector[j] for j in range(len(vector))) for i in range(len(matrix))]
1413
-
1414
-
1415
-
1416
-
1417
-
1418
-
1419
-
1420
-
1421
- def softmax(self, x):
1422
- m = max(x)
1423
- exps = [math.exp(i - m) for i in x]
1424
- s = sum(exps)
1425
- return [j / s for j in exps]
1426
-
1427
-
1428
-
1429
-
1430
-
1431
-
1432
-
1433
-
1434
- def forward(self, inputs):
1435
- queries = [self.matmul_vector(self.W_q, token) for token in inputs]
1436
- keys = [self.matmul_vector(self.W_k, token) for token in inputs]
1437
- values = [self.matmul_vector(self.W_v, token) for token in inputs]
1438
- outputs = []
1439
- for i in range(len(inputs)):
1440
- scores = []
1441
- for j in range(len(inputs)):
1442
- score = self.dot_product(queries[i], keys[j]) / math.sqrt(self.d_model)
1443
- scores.append(score)
1444
- attn = self.softmax(scores)
1445
- attn_output = [0] * self.d_model
1446
- for j in range(len(inputs)):
1447
- for k in range(self.d_model):
1448
- attn_output[k] += attn[j] * values[j][k]
1449
- out = self.matmul_vector(self.W_o, attn_output)
1450
- outputs.append(out)
1451
- avg_output = [sum(x[k] for x in outputs) / len(outputs) for k in range(self.d_model)]
1452
- proj_weights = [[random.random() for _ in range(self.d_model)] for _ in range(self.num_tokens)]
1453
- proj_bias = [random.random() for _ in range(self.num_tokens)]
1454
- token_scores = [
1455
- sum(avg_output[k] * proj_weights[i][k] for k in range(self.d_model)) + proj_bias[i]
1456
- for i in range(self.num_tokens)
1457
- ]
1458
- token_output = [1 / (1 + math.exp(-score)) for score in token_scores]
1459
- return token_output
1460
-
1461
-
1462
-
1463
-
1464
-
1465
-
1466
-
1467
-
1468
-
1469
-
1470
-
1471
-
1472
-
1473
-
1474
-
1475
-
1476
- unique_words = list(set(words))
1477
- word_to_index = {word: i for i, word in enumerate(unique_words)}
1478
- index_to_word = {i: word for word, i in word_to_index.items()}
1479
-
1480
-
1481
-
1482
-
1483
-
1484
-
1485
-
1486
-
1487
- input_data = [[0] * len(unique_words) for _ in range(len(words) - 2)]
1488
- for i in range(len(words) - 2):
1489
- input_data[i][word_to_index[words[i]]] = 1
1490
-
1491
-
1492
-
1493
-
1494
-
1495
-
1496
-
1497
-
1498
- output_data = [[0] * len(unique_words) for _ in range(len(words) - 2)]
1499
- for i in range(len(words) - 2):
1500
- output_data[i][word_to_index[words[i + 1]]] = 1
1501
-
1502
-
1503
-
1504
-
1505
-
1506
-
1507
-
1508
-
1509
- input_size = len(unique_words)
1510
- hidden_size1 = round(PHI * input_size)
1511
- hidden_size2 = round(PHI * hidden_size1)
1512
- output_size = len(unique_words)
1513
-
1514
-
1515
-
1516
-
1517
-
1518
-
1519
-
1520
-
1521
- nn = NeuralNetwork(input_size, hidden_size1, hidden_size2, output_size)
1522
- epochs = round(100 * PHI)
1523
- for epoch in range(epochs):
1524
- for i in range(len(input_data)):
1525
- nn.forward(input_data[i])
1526
- nn.backward(input_data[i], output_data[i], learning_rate=0.1)
1527
- if (epoch + 1) % round(PHI) == 0:
1528
- print("Feedforward NN Epoch {}/{}".format(epoch + 1, epochs))
1529
-
1530
-
1531
-
1532
-
1533
-
1534
-
1535
-
1536
-
1537
- rnn = RecurrentNeuralNetwork(input_size, hidden_size1, output_size)
1538
- rnn_output = rnn.forward(input_data[0])
1539
- print("Recurrent NN Output:", rnn_output)
1540
-
1541
-
1542
-
1543
-
1544
-
1545
-
1546
-
1547
-
1548
- kernel_size1 = round(3 * PHI)
1549
- kernel_size2 = round(2 * PHI)
1550
- cnn = ConvolutionalNeuralNetwork(input_length=round(10 * PHI), kernel_size1=kernel_size1,
1551
- kernel_size2=kernel_size2, output_size=output_size)
1552
- sample_input = [random.random() for _ in range(round(10 * PHI))]
1553
- cnn_output = cnn.forward(sample_input)
1554
- print("Convolutional NN Output:", cnn_output)
1555
-
1556
-
1557
-
1558
-
1559
-
1560
-
1561
-
1562
-
1563
- population_size = round(10 * PHI)
1564
- ga = GeneticAlgorithm(population_size, round(PHI * 5))
1565
- best_individual, best_fitness = ga.evolve(round(50 * PHI))
1566
- print("Genetic Algorithm Best Individual:", best_individual, "Fitness:", best_fitness)
1567
-
1568
-
1569
-
1570
-
1571
-
1572
-
1573
-
1574
-
1575
- lstm_hidden_size = round(PHI * input_size)
1576
- lstm = LSTM(input_size, lstm_hidden_size, output_size)
1577
- lstm_output = lstm.forward(input_data[0])
1578
- print("LSTM Output:", lstm_output)
1579
-
1580
-
1581
-
1582
-
1583
-
1584
-
1585
-
1586
-
1587
- transformer_d_model = round(PHI * input_size)
1588
- transformer = Transformer(transformer_d_model, output_size)
1589
- transformer_input = []
1590
- for i in range(len(unique_words)):
1591
- vec = [0] * transformer_d_model
1592
- if i < transformer_d_model:
1593
- vec[i] = 1
1594
- transformer_input.append(vec)
1595
- transformer_output = transformer.forward(transformer_input)
1596
- print("Transformer Output:", transformer_output)
1597
-
1598
-
1599
-
1600
-
1601
-
1602
-
1603
-
1604
-
1605
-
1606
-
1607
-
1608
-
1609
-
1610
-
1611
-
1612
-
1613
-
1614
-
1615
-
1616
-
1617
-
1618
-
1619
-
1620
-
1621
-
1622
-
1623
-
1624
-
1625
-
1626
-
1627
-
1628
-
1629
-
1630
-
1631
-
1632
-
1633
-
1634
-
1635
- import gradio as gr
1636
- from openai import OpenAI
1637
-
1638
- hf_token = os.getenv(HF_TOKEN)
1639
-
1640
- # Load system prompt from environment variable
1641
- SYSTEM_PROMPT = os.getenv("SYSTEM_PROMPT")
1642
-
1643
- print(SYSTEM_PROMPT)
1644
-
1645
- # Initialize client
1646
- client = OpenAI(
1647
- base_url="https://router.huggingface.co/together/v1",
1648
- api_key=hf_token
1649
- )
1650
-
1651
- def predict(message, history):
1652
- # If history is empty, insert the system prompt
1653
- if not any(msg["role"] == "system" for msg in history):
1654
- history.insert(0, {"role": "system", "content": SYSTEM_PROMPT})
1655
-
1656
- history.append({"role": "user", "content": message})
1657
-
1658
- stream = client.chat.completions.create(
1659
- messages=history,
1660
- model=os.getenv("ACCEMULECTPLUS"),
1661
- stream=True
1662
- )
1663
-
1664
- chunks = []
1665
- for chunk in stream:
1666
- chunks.append(chunk.choices[0].delta.content or "")
1667
- yield "".join(chunks)
1668
-
1669
- demo = gr.ChatInterface(
1670
- fn=predict,
1671
- type="messages",
1672
- chatbot=gr.Chatbot(
1673
- type="messages",
1674
- label="💙ACC Emulect+💙",
1675
- avatar_images=(
1676
- "https://huggingface.co/spaces/TejAndrewsACC/Z3ta_Z/resolve/main/Screenshot_20250201-131420.png",
1677
- "https://huggingface.co/spaces/TejAndrewsACC/ACC-Emulect-Plus/resolve/main/IMG_1433.jpeg"
1678
- ),
1679
- placeholder="💙Hi, I'm ACC Emulect+💙",
1680
- ),
1681
- theme="TejAndrewsACC/Emulect",
1682
- )
1683
-
1684
- if __name__ == "__main__":
1685
- demo.launch(share=True)
1686
-
1687
-
1688
-
1689
-
1690
-
1691
-
1692
 
1693
 
1694
  # coding=utf-8
 
5
 
6
 
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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