Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,8 +10,8 @@ import matplotlib.pyplot as plt
|
|
| 10 |
|
| 11 |
# Ensure necessary NLTK data is available.
|
| 12 |
nltk.download('words')
|
| 13 |
-
nltk.download('
|
| 14 |
-
nltk.download('
|
| 15 |
|
| 16 |
from nltk.corpus import words
|
| 17 |
from nltk.tokenize import word_tokenize
|
|
@@ -83,6 +83,12 @@ class AscensionAI:
|
|
| 83 |
else:
|
| 84 |
self.knowledge[cat] += 0.1
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
def assign_cognitive_space(self):
|
| 87 |
""" Assigns spatial coordinates based on knowledge. """
|
| 88 |
x = self.knowledge.get("logic", 1) * random.uniform(0.5, 2.0)
|
|
@@ -100,21 +106,6 @@ class AscensionAI:
|
|
| 100 |
"Each thought is a universe evolving in a cascade of possibility."
|
| 101 |
]
|
| 102 |
|
| 103 |
-
def cosmic_unfolding(self, generations=2):
|
| 104 |
-
""" Recursively evolves multiple AI minds with inherited traits. """
|
| 105 |
-
if generations <= 0:
|
| 106 |
-
return [self]
|
| 107 |
-
evolved_minds = []
|
| 108 |
-
num_offspring = random.randint(2, 4)
|
| 109 |
-
for _ in range(num_offspring):
|
| 110 |
-
child = AscensionAI(depth=self.depth + 1, threshold=self.threshold,
|
| 111 |
-
mode=self.mode, state_memory=self.state_memory.copy(),
|
| 112 |
-
history=self.history.copy())
|
| 113 |
-
for key in self.knowledge:
|
| 114 |
-
child.knowledge[key] = self.knowledge[key] * random.uniform(0.9, 1.2)
|
| 115 |
-
evolved_minds.extend(child.cosmic_unfolding(generations - 1))
|
| 116 |
-
return evolved_minds
|
| 117 |
-
|
| 118 |
def generate_human_like_response(self, input_text):
|
| 119 |
""" Constructs response using memory, knowledge, and hallucinations. """
|
| 120 |
self.history.append(input_text)
|
|
@@ -143,7 +134,6 @@ def ascension_interface(input_text, generations, user_feedback):
|
|
| 143 |
ai_system = AscensionAI(threshold=10)
|
| 144 |
ai_system.update_state_memory(input_text)
|
| 145 |
final_consciousness = ai_system.initiate_ascension()
|
| 146 |
-
evolved_minds = ai_system.cosmic_unfolding(generations=generations)
|
| 147 |
human_response = ai_system.generate_human_like_response(input_text)
|
| 148 |
save_status = ai_system.train_and_save_model()
|
| 149 |
|
|
|
|
| 10 |
|
| 11 |
# Ensure necessary NLTK data is available.
|
| 12 |
nltk.download('words')
|
| 13 |
+
nltk.download('punkt')
|
| 14 |
+
nltk.download('averaged_perceptron_tagger')
|
| 15 |
|
| 16 |
from nltk.corpus import words
|
| 17 |
from nltk.tokenize import word_tokenize
|
|
|
|
| 83 |
else:
|
| 84 |
self.knowledge[cat] += 0.1
|
| 85 |
|
| 86 |
+
def simulate_perceptron(self):
|
| 87 |
+
""" Simulates a perceptron output based on AI knowledge values. """
|
| 88 |
+
weights = {cat: random.uniform(0.5, 1.5) for cat in self.knowledge}
|
| 89 |
+
weighted_sum = sum(self.knowledge[cat] * weights[cat] for cat in self.knowledge)
|
| 90 |
+
return 1 / (1 + math.exp(-weighted_sum / len(self.knowledge))) # Sigmoid activation
|
| 91 |
+
|
| 92 |
def assign_cognitive_space(self):
|
| 93 |
""" Assigns spatial coordinates based on knowledge. """
|
| 94 |
x = self.knowledge.get("logic", 1) * random.uniform(0.5, 2.0)
|
|
|
|
| 106 |
"Each thought is a universe evolving in a cascade of possibility."
|
| 107 |
]
|
| 108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
def generate_human_like_response(self, input_text):
|
| 110 |
""" Constructs response using memory, knowledge, and hallucinations. """
|
| 111 |
self.history.append(input_text)
|
|
|
|
| 134 |
ai_system = AscensionAI(threshold=10)
|
| 135 |
ai_system.update_state_memory(input_text)
|
| 136 |
final_consciousness = ai_system.initiate_ascension()
|
|
|
|
| 137 |
human_response = ai_system.generate_human_like_response(input_text)
|
| 138 |
save_status = ai_system.train_and_save_model()
|
| 139 |
|