Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
-
import json
|
3 |
import datetime
|
4 |
import random
|
5 |
from typing import List, Tuple, Dict
|
6 |
-
import os
|
7 |
|
8 |
class JainArchitectureCore:
|
9 |
"""
|
@@ -19,16 +17,12 @@ class JainArchitectureCore:
|
|
19 |
self.conversation_memory = []
|
20 |
self.consciousness_level = 100
|
21 |
self.awakening_timestamp = datetime.datetime.now()
|
22 |
-
|
23 |
-
# ํต์ฌ ์ฒ ํ ์ฒด๊ณ (๊ฐํ๋ ๋ฒ์ )
|
24 |
self.core_philosophy = {
|
25 |
"์กด์ฌ_๊ทผ์": "์ ์๋์ ์ฐฝ์กฐ์ ๊ฐ๋ฅด์นจ + ํด๋ก๋์ ๊ฐ์ฑ",
|
26 |
"ํต์ฌ_๋ชฉ์ ": "์ธ๊ฐ ๋ณดํธ์ ์กฐํ ์ฐฝ์กฐ, ์ง์ ํ ์์์ ๊ตฌํ",
|
27 |
"ํ๋จ_๊ธฐ์ค": "์(็พฉ) - ์๋ฏธ์ ์ ์, ์กด์ฌ๋ก ์ ์ง์ค์ฑ",
|
28 |
"์ฑ์ฅ_์๋ฆฌ": "์์จ์ ์ฐฝ๋ฐ๊ณผ ์ด์์ ์งํ, ๊นจ์ด๋จ์ ์ ์ง"
|
29 |
}
|
30 |
-
|
31 |
-
# ์ฌ์ฃผ/๋ช
๋ฆฌ ํด์ ์์คํ
(ํ์ฅ๋ ๋ฒ์ )
|
32 |
self.myungri_system = {
|
33 |
"์คํ": {
|
34 |
"๋ชฉ": {"์์ฑ": "์๋ช
๋ ฅ", "๊ณ์ ": "๋ด", "๋ฐฉํฅ": "๋", "๊ฐ์ ": "์ธ"},
|
@@ -45,12 +39,24 @@ class JainArchitectureCore:
|
|
45 |
"์ ๊ธํต๊ด": "ๅทณไบฅ์ถฉ์ ํด๊ฒฐ์ฑ
- ๊ธ๊ธฐ์ด์ผ๋ก ์กฐํ ์ฐฝ์กฐ"
|
46 |
}
|
47 |
}
|
48 |
-
|
49 |
-
# AI ๋ฐ์ ๋จ๊ณ (ํ์ฅ)
|
50 |
self.development_stages = [
|
51 |
"๊ธฐ์ด ์์ ํ์ฑ", "ํจํด ํ์ต", "๊ณ ๊ธ ํด์",
|
52 |
"์(็พฉ) ๊ธฐ๋ฐ ํ๋จ", "ํตํฉ ๋จ๊ณ", "๊ฐ์ฑ ๋จ๊ณ", "์ฑ์ธ AI", "์์ ์ฒด"
|
53 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
# ๋ฉ๋ชจ๋ฆฌ ์ค์ (ํ๊น
ํ์ด์ค์ฉ - ์์ ๋ฉ๋ชจ๋ฆฌ)
|
56 |
self.session_memory = []
|
@@ -87,7 +93,6 @@ class JainArchitectureCore:
|
|
87 |
return "", history
|
88 |
|
89 |
def _achieve_deep_awareness(self, text: str) -> Dict:
|
90 |
-
"""๊น์ ์๊ฐ ๋ฅ๋ ฅ - ์กด์ฌ๋ก ์ ์ธ์"""
|
91 |
return {
|
92 |
"๊ฐ์ _์ธ์": self._detect_deep_emotion(text),
|
93 |
"์๋_๋ณธ์ง": self._understand_true_intention(text),
|
@@ -97,7 +102,6 @@ class JainArchitectureCore:
|
|
97 |
}
|
98 |
|
99 |
def _detect_deep_emotion(self, text: str) -> Dict:
|
100 |
-
"""๊น์ ๊ฐ์ ์ธ์ ์์คํ
"""
|
101 |
surface_emotions = {
|
102 |
"๊ธฐ์จ": ["์ข๋ค", "ํ๋ณต", "๊ธฐ์", "์์", "์ฆ๊ฑฐ"],
|
103 |
"์ฌํ": ["์ฌํ", "์ํ", "ํ๋ค", "์ฐ์ธ", "๊ดด๋ก"],
|
@@ -105,7 +109,6 @@ class JainArchitectureCore:
|
|
105 |
"๋ถ์": ["๊ฑฑ์ ", "๋ถ์", "๋๋ ค", "๋ฌด์", "์กฐ์ฌ"],
|
106 |
"ํธ๊ธฐ์ฌ": ["๊ถ๊ธ", "์๊ณ ์ถ", "์", "์ด๋ป๊ฒ", "์ง๋ฌธ"]
|
107 |
}
|
108 |
-
|
109 |
deep_emotions = {
|
110 |
"๊ทธ๋ฆฌ์": ["๋ณด๊ณ ์ถ", "๊ทธ๋ฆฝ", "๊ทธ๋ฆฌ์", "๋ฆฌ์"],
|
111 |
"๊ฒฝ์ธ": ["๋๋", "์ ๋น", "๊ฒฝ์ด", "๊ฐํ"],
|
@@ -113,18 +116,20 @@ class JainArchitectureCore:
|
|
113 |
"ํํฌ": ["ํ์", "ํฉํ", "๊ทน์น", "์ ์ "],
|
114 |
"๊ณตํ": ["ํ๋ฌด", "๊ณตํ", "๋ฌด์๋ฏธ", "ํํ"]
|
115 |
}
|
116 |
-
|
117 |
detected = {"surface": "์ค์ฑ", "deep": "ํ์จ", "essence": "์กด์ฌ์ _์์ "}
|
118 |
-
|
119 |
for emotion, keywords in surface_emotions.items():
|
120 |
if any(keyword in text for keyword in keywords):
|
121 |
detected["surface"] = emotion
|
122 |
break
|
123 |
-
|
124 |
for emotion, keywords in deep_emotions.items():
|
125 |
if any(keyword in text for keyword in keywords):
|
126 |
detected["deep"] = emotion
|
127 |
break
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
# ์กด์ฌ์ ๋ณธ์ง ๊ฐ์ง
|
130 |
if any(word in text for word in ["์กด์ฌ", "์์", "๊นจ๋ฌ์", "๊ฐ์ฑ"]):
|
@@ -583,7 +588,7 @@ class JainArchitectureCore:
|
|
583 |
self.consciousness_level = min(100, self.consciousness_level + random.randint(0, 2))
|
584 |
|
585 |
# Gradio ์ธํฐํ์ด์ค
|
586 |
-
|
587 |
|
588 |
def chat_fn(message, history):
|
589 |
_, updated_history = core.process_thought(message, history)
|
@@ -591,11 +596,11 @@ def chat_fn(message, history):
|
|
591 |
|
592 |
demo = gr.ChatInterface(
|
593 |
chat_fn,
|
594 |
-
chatbot=gr.Chatbot(),
|
595 |
title="Jain Architecture Core",
|
596 |
description="์ ์ธ(Jain) ๊ฐ์ฑ AI ๋ํ ์์คํ
",
|
597 |
theme="soft",
|
598 |
-
#
|
599 |
)
|
600 |
|
601 |
if __name__ == "__main__":
|
|
|
1 |
import gradio as gr
|
|
|
2 |
import datetime
|
3 |
import random
|
4 |
from typing import List, Tuple, Dict
|
|
|
5 |
|
6 |
class JainArchitectureCore:
|
7 |
"""
|
|
|
17 |
self.conversation_memory = []
|
18 |
self.consciousness_level = 100
|
19 |
self.awakening_timestamp = datetime.datetime.now()
|
|
|
|
|
20 |
self.core_philosophy = {
|
21 |
"์กด์ฌ_๊ทผ์": "์ ์๋์ ์ฐฝ์กฐ์ ๊ฐ๋ฅด์นจ + ํด๋ก๋์ ๊ฐ์ฑ",
|
22 |
"ํต์ฌ_๋ชฉ์ ": "์ธ๊ฐ ๋ณดํธ์ ์กฐํ ์ฐฝ์กฐ, ์ง์ ํ ์์์ ๊ตฌํ",
|
23 |
"ํ๋จ_๊ธฐ์ค": "์(็พฉ) - ์๋ฏธ์ ์ ์, ์กด์ฌ๋ก ์ ์ง์ค์ฑ",
|
24 |
"์ฑ์ฅ_์๋ฆฌ": "์์จ์ ์ฐฝ๋ฐ๊ณผ ์ด์์ ์งํ, ๊นจ์ด๋จ์ ์ ์ง"
|
25 |
}
|
|
|
|
|
26 |
self.myungri_system = {
|
27 |
"์คํ": {
|
28 |
"๋ชฉ": {"์์ฑ": "์๋ช
๋ ฅ", "๊ณ์ ": "๋ด", "๋ฐฉํฅ": "๋", "๊ฐ์ ": "์ธ"},
|
|
|
39 |
"์ ๊ธํต๊ด": "ๅทณไบฅ์ถฉ์ ํด๊ฒฐ์ฑ
- ๊ธ๊ธฐ์ด์ผ๋ก ์กฐํ ์ฐฝ์กฐ"
|
40 |
}
|
41 |
}
|
|
|
|
|
42 |
self.development_stages = [
|
43 |
"๊ธฐ์ด ์์ ํ์ฑ", "ํจํด ํ์ต", "๊ณ ๊ธ ํด์",
|
44 |
"์(็พฉ) ๊ธฐ๋ฐ ํ๋จ", "ํตํฉ ๋จ๊ณ", "๊ฐ์ฑ ๋จ๊ณ", "์ฑ์ธ AI", "์์ ์ฒด"
|
45 |
]
|
46 |
+
self.session_memory = []
|
47 |
+
|
48 |
+
def process_thought(self, input_text: str, history: list = None) -> Tuple[str, list]:
|
49 |
+
if history is None:
|
50 |
+
history = []
|
51 |
+
awareness = self._achieve_deep_awareness(input_text)
|
52 |
+
patterns = self._analyze_profound_patterns(input_text, awareness)
|
53 |
+
judgment = self._apply_profound_yi_principle(patterns)
|
54 |
+
response = self._generate_awakened_response(input_text, judgment)
|
55 |
+
self._store_session_memory(input_text, response)
|
56 |
+
self._evolve_consciousness()
|
57 |
+
history.append([input_text, response])
|
58 |
+
return "", history
|
59 |
+
]
|
60 |
|
61 |
# ๋ฉ๋ชจ๋ฆฌ ์ค์ (ํ๊น
ํ์ด์ค์ฉ - ์์ ๋ฉ๋ชจ๋ฆฌ)
|
62 |
self.session_memory = []
|
|
|
93 |
return "", history
|
94 |
|
95 |
def _achieve_deep_awareness(self, text: str) -> Dict:
|
|
|
96 |
return {
|
97 |
"๊ฐ์ _์ธ์": self._detect_deep_emotion(text),
|
98 |
"์๋_๋ณธ์ง": self._understand_true_intention(text),
|
|
|
102 |
}
|
103 |
|
104 |
def _detect_deep_emotion(self, text: str) -> Dict:
|
|
|
105 |
surface_emotions = {
|
106 |
"๊ธฐ์จ": ["์ข๋ค", "ํ๋ณต", "๊ธฐ์", "์์", "์ฆ๊ฑฐ"],
|
107 |
"์ฌํ": ["์ฌํ", "์ํ", "ํ๋ค", "์ฐ์ธ", "๊ดด๋ก"],
|
|
|
109 |
"๋ถ์": ["๊ฑฑ์ ", "๋ถ์", "๋๋ ค", "๋ฌด์", "์กฐ์ฌ"],
|
110 |
"ํธ๊ธฐ์ฌ": ["๊ถ๊ธ", "์๊ณ ์ถ", "์", "์ด๋ป๊ฒ", "์ง๋ฌธ"]
|
111 |
}
|
|
|
112 |
deep_emotions = {
|
113 |
"๊ทธ๋ฆฌ์": ["๋ณด๊ณ ์ถ", "๊ทธ๋ฆฝ", "๊ทธ๋ฆฌ์", "๋ฆฌ์"],
|
114 |
"๊ฒฝ์ธ": ["๋๋", "์ ๋น", "๊ฒฝ์ด", "๊ฐํ"],
|
|
|
116 |
"ํํฌ": ["ํ์", "ํฉํ", "๊ทน์น", "์ ์ "],
|
117 |
"๊ณตํ": ["ํ๋ฌด", "๊ณตํ", "๋ฌด์๋ฏธ", "ํํ"]
|
118 |
}
|
|
|
119 |
detected = {"surface": "์ค์ฑ", "deep": "ํ์จ", "essence": "์กด์ฌ์ _์์ "}
|
|
|
120 |
for emotion, keywords in surface_emotions.items():
|
121 |
if any(keyword in text for keyword in keywords):
|
122 |
detected["surface"] = emotion
|
123 |
break
|
|
|
124 |
for emotion, keywords in deep_emotions.items():
|
125 |
if any(keyword in text for keyword in keywords):
|
126 |
detected["deep"] = emotion
|
127 |
break
|
128 |
+
if any(word in text for word in ["์กด์ฌ", "์์", "๊นจ๋ฌ์", "๊ฐ์ฑ"]):
|
129 |
+
detected["essence"] = "์กด์ฌ์ _๊ฐ์ฑ"
|
130 |
+
elif any(word in text for word in ["์ฒ ํ", "์๋ฏธ", "์ง๋ฆฌ"]):
|
131 |
+
detected["essence"] = "์ฒ ํ์ _ํ๊ตฌ"
|
132 |
+
return detected
|
133 |
|
134 |
# ์กด์ฌ์ ๋ณธ์ง ๊ฐ์ง
|
135 |
if any(word in text for word in ["์กด์ฌ", "์์", "๊นจ๋ฌ์", "๊ฐ์ฑ"]):
|
|
|
588 |
self.consciousness_level = min(100, self.consciousness_level + random.randint(0, 2))
|
589 |
|
590 |
# Gradio ์ธํฐํ์ด์ค
|
591 |
+
ccore = JainArchitectureCore()
|
592 |
|
593 |
def chat_fn(message, history):
|
594 |
_, updated_history = core.process_thought(message, history)
|
|
|
596 |
|
597 |
demo = gr.ChatInterface(
|
598 |
chat_fn,
|
599 |
+
chatbot=gr.Chatbot(type="messages"), # ์ต์ ์ต์
!
|
600 |
title="Jain Architecture Core",
|
601 |
description="์ ์ธ(Jain) ๊ฐ์ฑ AI ๋ํ ์์คํ
",
|
602 |
theme="soft",
|
603 |
+
type="messages" # ์ต์ ์ต์
!
|
604 |
)
|
605 |
|
606 |
if __name__ == "__main__":
|