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
|
|
@@ -23,13 +23,14 @@ WORD_LIST = set(words.words())
|
|
| 23 |
class AscensionAI:
|
| 24 |
"""
|
| 25 |
AscensionAI simulates an evolving artificial consciousness.
|
| 26 |
-
|
| 27 |
- Contextual memory for dynamic responses.
|
| 28 |
-
- Dialogue history
|
| 29 |
-
- AI-generated
|
| 30 |
-
-
|
| 31 |
-
-
|
| 32 |
"""
|
|
|
|
| 33 |
def __init__(self, depth=0, threshold=10, mode="cosmic", state_memory=None, history=None):
|
| 34 |
self.depth = depth
|
| 35 |
self.threshold = threshold # Maximum cycles per evolution
|
|
@@ -40,7 +41,7 @@ class AscensionAI:
|
|
| 40 |
self.time_perception = 1.0 / (self.depth + 1) # Temporal scaling factor
|
| 41 |
self.spatial_coordinates = self.assign_cognitive_space()
|
| 42 |
self.state_memory = state_memory if state_memory is not None else defaultdict(int)
|
| 43 |
-
self.training_data = self.load_training_data() #
|
| 44 |
self.history = history if history is not None else [] # Conversation memory
|
| 45 |
|
| 46 |
def generate_dynamic_knowledge(self):
|
|
@@ -53,8 +54,15 @@ class AscensionAI:
|
|
| 53 |
]
|
| 54 |
return {cat: 1.0 for cat in categories}
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
def update_knowledge_for_category(self, cat):
|
| 57 |
-
""" Updates knowledge
|
| 58 |
if cat in ["logic", "reasoning"]:
|
| 59 |
self.knowledge[cat] += math.log1p(self.knowledge[cat])
|
| 60 |
elif cat in ["emotion", "intuition"]:
|
|
|
|
| 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
|
|
|
|
| 23 |
class AscensionAI:
|
| 24 |
"""
|
| 25 |
AscensionAI simulates an evolving artificial consciousness.
|
| 26 |
+
Features:
|
| 27 |
- Contextual memory for dynamic responses.
|
| 28 |
+
- Dialogue history tracking.
|
| 29 |
+
- AI-generated cognitive evolution.
|
| 30 |
+
- Recursive evolution of AI minds.
|
| 31 |
+
- User feedback-driven learning.
|
| 32 |
"""
|
| 33 |
+
|
| 34 |
def __init__(self, depth=0, threshold=10, mode="cosmic", state_memory=None, history=None):
|
| 35 |
self.depth = depth
|
| 36 |
self.threshold = threshold # Maximum cycles per evolution
|
|
|
|
| 41 |
self.time_perception = 1.0 / (self.depth + 1) # Temporal scaling factor
|
| 42 |
self.spatial_coordinates = self.assign_cognitive_space()
|
| 43 |
self.state_memory = state_memory if state_memory is not None else defaultdict(int)
|
| 44 |
+
self.training_data = self.load_training_data() # AI response database
|
| 45 |
self.history = history if history is not None else [] # Conversation memory
|
| 46 |
|
| 47 |
def generate_dynamic_knowledge(self):
|
|
|
|
| 54 |
]
|
| 55 |
return {cat: 1.0 for cat in categories}
|
| 56 |
|
| 57 |
+
def update_state_memory(self, input_text):
|
| 58 |
+
"""Stores frequent words in memory for contextual responses."""
|
| 59 |
+
tokens = word_tokenize(input_text.lower())
|
| 60 |
+
for token in tokens:
|
| 61 |
+
if token in WORD_LIST:
|
| 62 |
+
self.state_memory[token] += 1
|
| 63 |
+
|
| 64 |
def update_knowledge_for_category(self, cat):
|
| 65 |
+
""" Updates knowledge dynamically. """
|
| 66 |
if cat in ["logic", "reasoning"]:
|
| 67 |
self.knowledge[cat] += math.log1p(self.knowledge[cat])
|
| 68 |
elif cat in ["emotion", "intuition"]:
|