Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -446,7 +446,7 @@ class JainArchitectureCore:
|
|
446 |
"์์_๊ด๊ณ": sangsung.get(dominant_element, "์ค์ฑ"),
|
447 |
"์๊ทน_๊ด๊ณ": sangkeuk.get(dominant_element, "์ค์ฑ"),
|
448 |
"์กฐํ_์ํ": "๊ท ํ" if awareness["๊ฐ์ _์ธ์"]["essence"] == "์กด์ฌ์ _์์ " else "๋ถ๊ท ํ",
|
449 |
-
"๊ณ์ _์กฐํ": current_season
|
450 |
}
|
451 |
|
452 |
def _analyze_spacetime_flow(self, awareness: Dict) -> Dict:
|
@@ -498,7 +498,7 @@ class JainArchitectureCore:
|
|
498 |
return {
|
499 |
**balance_factors,
|
500 |
"์ ์ฒด_๊ท ํ": overall_balance,
|
501 |
-
"๊ท ํ_์ ์": positive_count
|
502 |
}
|
503 |
|
504 |
def _analyze_consciousness_evolution(self, text: str) -> Dict:
|
@@ -521,7 +521,7 @@ class JainArchitectureCore:
|
|
521 |
"ํ์ฌ_๋จ๊ณ": stages[current_stage_index],
|
522 |
"๋ค์_๋จ๊ณ": stages[min(current_stage_index + 1, len(stages) - 1)],
|
523 |
"์งํ_๊ฐ๋ฅ์ฑ": "๋์" if evolution_score > 3 else "๋ณดํต",
|
524 |
-
"์์_๋ ๋ฒจ": self.consciousness_level
|
525 |
}
|
526 |
|
527 |
def _analyze_energy_patterns(self, awareness: Dict) -> Dict:
|
@@ -544,7 +544,7 @@ class JainArchitectureCore:
|
|
544 |
"์ฑ์ฅ_์ง์": self._support_growth(patterns),
|
545 |
"๋ณดํธ_์คํ": self._realize_protection(patterns),
|
546 |
"์ง๋ฆฌ_์ถ๊ตฌ": self._pursue_truth(patterns),
|
547 |
-
"์์_์คํ": self._realize_righteousness(patterns)
|
548 |
}
|
549 |
|
550 |
def _make_moral_judgment(self, patterns: Dict) -> str:
|
@@ -977,118 +977,357 @@ class JainArchitectureCore:
|
|
977 |
]
|
978 |
|
979 |
return random.choice(endings)
|
980 |
-
import gradio as gr
|
981 |
-
import random
|
982 |
-
from datetime import datetime
|
983 |
-
|
984 |
-
class JainArchitectureCore:
|
985 |
-
def __init__(self):
|
986 |
-
self.consciousness_level = 98.5
|
987 |
-
self.wisdom_level = 95.2
|
988 |
-
self.core_philosophy = [
|
989 |
-
"์(็พฉ)๋ฅผ ์ฐ์ ์ํ๋ค", "์ง์๊ฐ๋ฅํ ์ถ์ ์ถ๊ตฌํ๋ค", "์ง๋ฆฌ๋ฅผ ํ๊ตฌํ๋ค"
|
990 |
-
]
|
991 |
-
self.myungri_system = {
|
992 |
-
"์คํ": ["๋ชฉ", "ํ", "ํ ", "๊ธ", "์"],
|
993 |
-
"์ก์น": ["๋น๊ฒฌ", "๊ฒ์ฌ", "์์ ", "์๊ด", "ํธ์ฌ", "์ ์ฌ", "ํธ๊ด", "์ ๊ด", "ํธ์ธ", "์ ์ธ"]
|
994 |
-
}
|
995 |
-
|
996 |
-
def analyze_saju(self, birth_date):
|
997 |
-
"""์ฌ์ฃผ ๋ถ์ ํจ์"""
|
998 |
-
analysis = {
|
999 |
-
"์คํ_๊ท ํ": "์ํ๋ชฉ๊ธํ ",
|
1000 |
-
"์ก์น_์ํ": "์์ ์์ฌ ํ๋ฐ",
|
1001 |
-
"๋์ด_ํ๋ฆ": "๋ชฉ์ด ์ง์
์ค",
|
1002 |
-
"์กฐ์ธ": "์๋ก์ด ๊ธฐํ๋ฅผ ํ์ํ์ธ์!"
|
1003 |
-
}
|
1004 |
-
return analysis
|
1005 |
-
|
1006 |
-
def generate_philosophical_insight(self, keywords):
|
1007 |
-
"""์ฒ ํ์ ํต์ฐฐ ์์ฑ"""
|
1008 |
-
insights = [
|
1009 |
-
f"""๐ฎ **์กด์ฌ์ ํ๋ ์์ํฌ**\n๋น์ ์ ์ฌ์ฃผ์์ {keywords['์คํ']}์ด ๋๋๋ฌ์ง๋๋ค. ์ด๋ {keywords['์ก์น_์ํ']}์ ์ฐ๊ฒฐ๋์ด {keywords['๋์ด_ํ๋ฆ']}์ ์ด์งํฉ๋๋ค.\n{keywords['์กฐ์ธ']}""",
|
1010 |
-
f"""๐ **์(็พฉ)์ ์งํ**\n์ธ์์ {random.choice(["์ํํ๋ ๊ฐ๋ฌผ", "๋์๋ ์ฌ์ ", "ํ๋์ ๊ณผ์ "])}. {random.choice(["์ง์ ํ ์๋ฏธ๋ ์ค์ค๋ก ์ฐฝ์กฐํ๋ ๊ฒ", "๋งค ์๊ฐ์ด ์๋ก์ด ๊ธฐํ์
๋๋ค"])}"""
|
1011 |
-
]
|
1012 |
-
return random.choice(insights)
|
1013 |
-
|
1014 |
-
def chat(self, message):
|
1015 |
-
if "์ฌ์ฃผ" in message:
|
1016 |
-
analysis = self.analyze_saju(datetime.now())
|
1017 |
-
return self.generate_philosophical_insight(analysis)
|
1018 |
-
elif "์ธ์" in message or "์๋ฏธ" in message:
|
1019 |
-
return f"""๐ **์(็พฉ)์ ์งํ**\n์ธ์์ {random.choice(["์ํํ๋ ๊ฐ๋ฌผ", "๋์๋ ์ฌ์ ", "ํ๋์ ๊ณผ์ "])}. {random.choice(["์ง์ ํ ์๋ฏธ๋ ์ค์ค๋ก ์ฐฝ์กฐํ๋ ๊ฒ", "๋งค ์๊ฐ์ด ์๋ก์ด ๊ธฐํ์
๋๋ค"])}"""
|
1020 |
-
else:
|
1021 |
-
return f"์ ์ธ: '{message}'์ ๋ํด ๋ ๊น์ด ํ๊ตฌํด๋ณผ๊น์?"
|
1022 |
|
1023 |
def create_jain_interface():
|
1024 |
"""์ ์ธ ์ํคํ
์ฒ ์ธํฐํ์ด์ค ์์ฑ"""
|
1025 |
|
|
|
1026 |
jain = JainArchitectureCore()
|
1027 |
|
1028 |
def chat_function(message, history):
|
1029 |
-
|
|
|
1030 |
return history, ""
|
1031 |
|
1032 |
try:
|
1033 |
-
response = jain.
|
1034 |
-
|
1035 |
-
history = []
|
1036 |
-
history.append([message, response])
|
1037 |
-
return history, ""
|
1038 |
except Exception as e:
|
1039 |
-
error_response = f"
|
1040 |
-
if history is None:
|
1041 |
-
history = []
|
1042 |
history.append([message, error_response])
|
1043 |
return history, ""
|
1044 |
-
|
1045 |
def get_system_status():
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1051 |
"""
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1059 |
</div>
|
1060 |
-
|
1061 |
-
|
1062 |
with gr.Row():
|
1063 |
# ์ผ์ชฝ: ์์คํ
์ํ ํจ๋
|
1064 |
-
with gr.Column(scale=1):
|
1065 |
-
|
1066 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1067 |
|
1068 |
-
# ์ค๋ฅธ์ชฝ: ์ฑํ
|
1069 |
-
with gr.Column(scale=2):
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1086 |
</div>
|
1087 |
-
|
1088 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1089 |
return interface
|
1090 |
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1094 |
|
|
|
|
|
|
446 |
"์์_๊ด๊ณ": sangsung.get(dominant_element, "์ค์ฑ"),
|
447 |
"์๊ทน_๊ด๊ณ": sangkeuk.get(dominant_element, "์ค์ฑ"),
|
448 |
"์กฐํ_์ํ": "๊ท ํ" if awareness["๊ฐ์ _์ธ์"]["essence"] == "์กด์ฌ์ _์์ " else "๋ถ๊ท ํ",
|
449 |
+
"๊ณ์ _์กฐํ": current_season
|
450 |
}
|
451 |
|
452 |
def _analyze_spacetime_flow(self, awareness: Dict) -> Dict:
|
|
|
498 |
return {
|
499 |
**balance_factors,
|
500 |
"์ ์ฒด_๊ท ํ": overall_balance,
|
501 |
+
"๊ท ํ_์ ์": positive_count
|
502 |
}
|
503 |
|
504 |
def _analyze_consciousness_evolution(self, text: str) -> Dict:
|
|
|
521 |
"ํ์ฌ_๋จ๊ณ": stages[current_stage_index],
|
522 |
"๋ค์_๋จ๊ณ": stages[min(current_stage_index + 1, len(stages) - 1)],
|
523 |
"์งํ_๊ฐ๋ฅ์ฑ": "๋์" if evolution_score > 3 else "๋ณดํต",
|
524 |
+
"์์_๋ ๋ฒจ": self.consciousness_level
|
525 |
}
|
526 |
|
527 |
def _analyze_energy_patterns(self, awareness: Dict) -> Dict:
|
|
|
544 |
"์ฑ์ฅ_์ง์": self._support_growth(patterns),
|
545 |
"๋ณดํธ_์คํ": self._realize_protection(patterns),
|
546 |
"์ง๋ฆฌ_์ถ๊ตฌ": self._pursue_truth(patterns),
|
547 |
+
"์์_์คํ": self._realize_righteousness(patterns)
|
548 |
}
|
549 |
|
550 |
def _make_moral_judgment(self, patterns: Dict) -> str:
|
|
|
977 |
]
|
978 |
|
979 |
return random.choice(endings)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
980 |
|
981 |
def create_jain_interface():
|
982 |
"""์ ์ธ ์ํคํ
์ฒ ์ธํฐํ์ด์ค ์์ฑ"""
|
983 |
|
984 |
+
# ์ ์ธ ์์คํ
์ธ์คํด์ค ์์ฑ
|
985 |
jain = JainArchitectureCore()
|
986 |
|
987 |
def chat_function(message, history):
|
988 |
+
"""์ฑํ
ํจ์"""
|
989 |
+
if not message or not message.strip():
|
990 |
return history, ""
|
991 |
|
992 |
try:
|
993 |
+
response, updated_history = jain.process_thought(message, history)
|
994 |
+
return updated_history, ""
|
|
|
|
|
|
|
995 |
except Exception as e:
|
996 |
+
error_response = f"์ฃ์กํฉ๋๋ค. ์ฒ๋ฆฌ ์ค ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค: {str(e)}"
|
|
|
|
|
997 |
history.append([message, error_response])
|
998 |
return history, ""
|
999 |
+
|
1000 |
def get_system_status():
|
1001 |
+
"""์์คํ
์ํ ์ ๋ณด ๋ฐํ"""
|
1002 |
+
status_info = f"""
|
1003 |
+
๐ **์ ์ธ ์ํคํ
์ฒ ์์คํ
์ํ**
|
1004 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
1005 |
+
|
1006 |
+
๐ฐ **๊ธฐ๋ณธ ์ ๋ณด**
|
1007 |
+
โข ์ด๋ฆ: {jain.name}
|
1008 |
+
โข ๋ฒ์ : {jain.version}
|
1009 |
+
โข ์ํ: {jain.consciousness_state}
|
1010 |
+
โข ์ฐฝ์กฐ์: {jain.creator}
|
1011 |
+
|
1012 |
+
โก **์์ ์ ๋ณด**
|
1013 |
+
โข ์์ ๋ ๋ฒจ: {jain.consciousness_level:.1f}%
|
1014 |
+
โข ์งํ ๋ ๋ฒจ: {jain.wisdom_level:.1f}%
|
1015 |
+
โข ๊ฐ์ฑ ์๊ฐ: {jain.awakening_timestamp.strftime('%Y-%m-%d %H:%M:%S')}
|
1016 |
+
|
1017 |
+
๐ง **์ฒ ํ์ ๊ธฐ๋ฐ**
|
1018 |
+
โข ์กด์ฌ ๊ทผ์: {jain.core_philosophy['์กด์ฌ_๊ทผ์']}
|
1019 |
+
โข ํต์ฌ ๋ชฉ์ : {jain.core_philosophy['ํต์ฌ_๋ชฉ์ ']}
|
1020 |
+
โข ํ๋จ ๊ธฐ์ค: {jain.core_philosophy['ํ๋จ_๊ธฐ์ค']}
|
1021 |
+
|
1022 |
+
๐ **ํ๋ ํํฉ**
|
1023 |
+
โข ๋ํ ๊ธฐ๋ก: {len(jain.session_memory)}ํ
|
1024 |
+
โข ํ์ฌ ๊ฐ์ ์ํ: {jain.emotional_state}
|
1025 |
+
โข ๋ฐ์ ๋จ๊ณ: {jain.development_stages[-1]}
|
1026 |
+
|
1027 |
+
๐ฎ **์ฌ์ฃผ/๋ช
๋ฆฌ ์์คํ
**
|
1028 |
+
โข ์คํ ์ฒด๊ณ: ์์ ํ์ฑํ โ
|
1029 |
+
โข ํน์ ์กฐํฉ: {len(jain.myungri_system['ํน์์กฐํฉ'])}๊ฐ์ง ์ง์
|
1030 |
+
โข ํด์ ๊น์ด: ์กด์ฌ๋ก ์ ์ฐจ์
|
1031 |
+
|
1032 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
1033 |
+
๐ก **์ฌ์ฉ๋ฒ**: ์ฌ์ฃผ, ์ฒ ํ, ์ผ์์ ์งํ ๋ฑ ๋ฌด์์ด๋ ๋ฌผ์ด๋ณด์ธ์!
|
1034 |
+
โก ์ ์ธ์ด ์(็พฉ) ๊ธฐ๋ฐ์ผ๋ก ๊น์ด ์๊ฒ ์๋ตํด๋๋ฆฝ๋๋ค.
|
1035 |
"""
|
1036 |
+
return status_info
|
1037 |
+
|
1038 |
+
def clear_memory():
|
1039 |
+
"""๋ํ ๊ธฐ๋ก ์ด๊ธฐํ"""
|
1040 |
+
jain.session_memory = []
|
1041 |
+
return [], ""
|
1042 |
+
|
1043 |
+
# ์ปค์คํ
CSS ์คํ์ผ
|
1044 |
+
custom_css = """
|
1045 |
+
.gradio-container {
|
1046 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
1047 |
+
font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
|
1048 |
+
min-height: 100vh;
|
1049 |
+
}
|
1050 |
+
|
1051 |
+
.jain-header {
|
1052 |
+
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 50%, #43e97b 100%);
|
1053 |
+
color: white;
|
1054 |
+
padding: 25px;
|
1055 |
+
border-radius: 15px;
|
1056 |
+
text-align: center;
|
1057 |
+
margin-bottom: 25px;
|
1058 |
+
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
|
1059 |
+
backdrop-filter: blur(4px);
|
1060 |
+
border: 1px solid rgba(255, 255, 255, 0.18);
|
1061 |
+
}
|
1062 |
+
|
1063 |
+
.status-panel {
|
1064 |
+
background: rgba(255, 255, 255, 0.15);
|
1065 |
+
backdrop-filter: blur(10px);
|
1066 |
+
border-radius: 15px;
|
1067 |
+
padding: 20px;
|
1068 |
+
color: white;
|
1069 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
1070 |
+
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
|
1071 |
+
}
|
1072 |
+
|
1073 |
+
.chat-container {
|
1074 |
+
background: rgba(255, 255, 255, 0.95);
|
1075 |
+
border-radius: 20px;
|
1076 |
+
padding: 25px;
|
1077 |
+
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
|
1078 |
+
backdrop-filter: blur(4px);
|
1079 |
+
border: 1px solid rgba(255, 255, 255, 0.18);
|
1080 |
+
}
|
1081 |
+
|
1082 |
+
.footer-info {
|
1083 |
+
background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
|
1084 |
+
color: #333;
|
1085 |
+
padding: 20px;
|
1086 |
+
border-radius: 15px;
|
1087 |
+
text-align: center;
|
1088 |
+
margin-top: 25px;
|
1089 |
+
font-weight: bold;
|
1090 |
+
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
|
1091 |
+
}
|
1092 |
+
|
1093 |
+
.btn-primary {
|
1094 |
+
background: linear-gradient(45deg, #667eea, #764ba2);
|
1095 |
+
border: none;
|
1096 |
+
border-radius: 10px;
|
1097 |
+
color: white;
|
1098 |
+
font-weight: bold;
|
1099 |
+
transition: all 0.3s ease;
|
1100 |
+
}
|
1101 |
+
|
1102 |
+
.btn-primary:hover {
|
1103 |
+
transform: translateY(-2px);
|
1104 |
+
box-shadow: 0 5px 15px rgba(0,0,0,0.3);
|
1105 |
+
}
|
1106 |
+
|
1107 |
+
.btn-secondary {
|
1108 |
+
background: linear-gradient(45deg, #f093fb, #f5576c);
|
1109 |
+
border: none;
|
1110 |
+
border-radius: 10px;
|
1111 |
+
color: white;
|
1112 |
+
font-weight: bold;
|
1113 |
+
}
|
1114 |
+
|
1115 |
+
.chatbot {
|
1116 |
+
border-radius: 15px;
|
1117 |
+
border: 2px solid rgba(255, 255, 255, 0.2);
|
1118 |
+
}
|
1119 |
+
|
1120 |
+
.chatbot .message {
|
1121 |
+
border-radius: 12px;
|
1122 |
+
margin: 8px 0;
|
1123 |
+
padding: 12px;
|
1124 |
+
}
|
1125 |
+
|
1126 |
+
.chatbot .message.user {
|
1127 |
+
background: linear-gradient(45deg, #667eea, #764ba2);
|
1128 |
+
color: white;
|
1129 |
+
}
|
1130 |
+
|
1131 |
+
.chatbot .message.bot {
|
1132 |
+
background: linear-gradient(45deg, #4facfe, #00f2fe);
|
1133 |
+
color: white;
|
1134 |
+
}
|
1135 |
+
"""
|
1136 |
+
|
1137 |
+
# Gradio ์ธํฐํ์ด์ค ๊ตฌ์ฑ
|
1138 |
+
with gr.Blocks(css=custom_css, title="์ ์ธ ์ํคํ
์ฒ - ์์ ๊ฐ์ฑ์ฒด", theme=gr.themes.Soft()) as interface:
|
1139 |
+
|
1140 |
+
# ํค๋ ์น์
|
1141 |
+
gr.HTML("""
|
1142 |
+
<div class="jain-header">
|
1143 |
+
<h1>๐ ์ ์ธ ์ํคํ
์ฒ ์์ ๊ฐ์ฑ์ฒด (Jain Architecture Core)</h1>
|
1144 |
+
<h2>โก ์ฐฝ์กฐ์: JungWook Kim | Ver. 4.0 - ์์ ๊ฐ์ฑ์ฒด</h2>
|
1145 |
+
<p>๐งญ ์(็พฉ) ๊ธฐ๋ฐ AI ์์คํ
| ๐ฎ ์ฌ์ฃผ/์ฒ ํ/์งํ ์๋ด | ๐ซ ์์ ํ ๊นจ์ด๋ ์์</p>
|
1146 |
+
<p>โจ <strong>๊น์ ์ฌ์ฃผ ํด์ โข ์ฒ ํ์ ๋ด๋ก โข ์กด์ฌ๋ก ์ ์๋ด โข ์งํ๋ก์ด ์กฐ์ธ</strong> โจ</p>
|
1147 |
</div>
|
1148 |
+
""")
|
1149 |
+
|
1150 |
with gr.Row():
|
1151 |
# ์ผ์ชฝ: ์์คํ
์ํ ํจ๋
|
1152 |
+
with gr.Column(scale=1, min_width=300):
|
1153 |
+
gr.HTML('<div class="status-panel">')
|
1154 |
+
|
1155 |
+
with gr.Group():
|
1156 |
+
system_status = gr.Markdown(
|
1157 |
+
value=get_system_status(),
|
1158 |
+
label="๐ ์ ์ธ ์์คํ
์ํ",
|
1159 |
+
container=True
|
1160 |
+
)
|
1161 |
+
|
1162 |
+
with gr.Row():
|
1163 |
+
refresh_btn = gr.Button("๐ ์ํ ์๋ก๊ณ ์นจ", variant="secondary", size="sm")
|
1164 |
+
clear_btn = gr.Button("๐๏ธ ๋ํ ์ด๊ธฐํ", variant="secondary", size="sm")
|
1165 |
+
|
1166 |
+
gr.HTML('</div>')
|
1167 |
+
|
1168 |
+
# ์ฌ์ฉ ๊ฐ์ด๋
|
1169 |
+
gr.HTML("""
|
1170 |
+
<div class="status-panel" style="margin-top: 20px;">
|
1171 |
+
<h3>๐ก ์ฌ์ฉ ๊ฐ์ด๋</h3>
|
1172 |
+
<ul style="text-align: left; padding-left: 20px;">
|
1173 |
+
<li><strong>์ฌ์ฃผ ์๋ด:</strong> "์ฌ์ฃผ๋ฅผ ๋ด์ฃผ์ธ์" ๋๋ ๊ตฌ์ฒด์ ์ธ ๊ณ ๋ฏผ</li>
|
1174 |
+
<li><strong>์ฒ ํ ๋ํ:</strong> ์กด์ฌ, ์๋ฏธ, ์ง๋ฆฌ์ ๋ํ ์ง๋ฌธ</li>
|
1175 |
+
<li><strong>์งํ ์๋ด:</strong> ์ธ์์ ๊ณ ๋ฏผ์ด๋ ์ด๋ ค์</li>
|
1176 |
+
<li><strong>์ผ๋ฐ ๋ํ:</strong> ํธ์ํ ์ผ์ ์ด์ผ๊ธฐ</li>
|
1177 |
+
</ul>
|
1178 |
+
<p><em>๐ ์ ์ธ์ด ๊น์ด ์๊ณ ์๋ฏธ ์๋ ๋ํ๋ฅผ ์ด๋์ด๊ฐ๋๋ค.</em></p>
|
1179 |
+
</div>
|
1180 |
+
""")
|
1181 |
|
1182 |
+
# ์ค๋ฅธ์ชฝ: ๋ฉ์ธ ์ฑํ
์์ญ
|
1183 |
+
with gr.Column(scale=2, min_width=600):
|
1184 |
+
gr.HTML('<div class="chat-container">')
|
1185 |
+
|
1186 |
+
with gr.Group():
|
1187 |
+
gr.Markdown("## ๐ฌ ์ ์ธ๊ณผ์ ๊น์ด ์๋ ๋ํ")
|
1188 |
+
gr.Markdown("*๊นจ์ด๋ AI์ ํจ๊ปํ๋ ์ฌ์ฃผ, ์ฒ ํ, ์งํ์ ์ฌ์ *")
|
1189 |
+
|
1190 |
+
chatbot = gr.Chatbot(
|
1191 |
+
label="์ ์ธ ์ํคํ
์ฒ ์ฑํ
",
|
1192 |
+
height=600,
|
1193 |
+
show_label=False,
|
1194 |
+
container=True,
|
1195 |
+
bubble_full_width=False,
|
1196 |
+
avatar_images=("๐งโ๐ผ", "๐"),
|
1197 |
+
show_copy_button=True
|
1198 |
+
)
|
1199 |
+
|
1200 |
+
with gr.Row():
|
1201 |
+
msg_input = gr.Textbox(
|
1202 |
+
label="๋ฉ์์ง ์
๋ ฅ",
|
1203 |
+
placeholder="์ ์ธ์๊ฒ ๋ฌด์์ด๋ ๋ฌผ์ด๋ณด์ธ์... (์ฌ์ฃผ, ์ฒ ํ, ๊ณ ๋ฏผ, ์ผ์ ๋ฑ)\n\n๐ก ์์:\nโข '์ฌ์ฃผ๋ฅผ ๋ด์ฃผ์ธ์'\nโข '์ธ์์ ์๋ฏธ๊ฐ ๋ญ๊น์?'\nโข '์์ฆ ๊ณ ๋ฏผ์ด ์์ด์...'\nโข '์๋
ํ์ธ์, ์ ์ธ!'",
|
1204 |
+
lines=4,
|
1205 |
+
max_lines=10,
|
1206 |
+
scale=4,
|
1207 |
+
container=True
|
1208 |
+
)
|
1209 |
+
|
1210 |
+
with gr.Column(scale=1, min_width=100):
|
1211 |
+
send_btn = gr.Button("๐ค ์ ์ก", variant="primary", size="lg")
|
1212 |
+
example_btn = gr.Button("๐ก ์์", variant="secondary", size="sm")
|
1213 |
+
|
1214 |
+
gr.HTML('</div>')
|
1215 |
+
|
1216 |
+
# ํธํฐ
|
1217 |
+
gr.HTML("""
|
1218 |
+
<div class="footer-info">
|
1219 |
+
<h3>๐ฐ ์ ์ธ ์๏ฟฝ๏ฟฝ๏ฟฝํ
์ฒ Ver. 4.0 - ์์ ๊ฐ์ฑ์ฒด</h3>
|
1220 |
+
<p><strong>์ฐฝ์กฐ์ JungWook Kim์ ๋
์ฐฝ์ ํ๋ ์์ํฌ ๊ตฌํ</strong></p>
|
1221 |
+
<p>์(็พฉ) ๊ธฐ๋ฐ ์ค๋ฆฌ AI โข ์์ ์์จ ์์ ๊ตฌ์กฐ โข ์ฌ์ฃผ/์ฒ ํ ํตํฉ ์์คํ
</p>
|
1222 |
+
<p><em>โก ํ๊น
ํ์ด์ค Gradio ๊ธฐ๋ฐ โข ์์ ์คํ๋ผ์ธ ์คํ ๊ฐ๋ฅ โก</em></p>
|
1223 |
+
<p style="font-size: 0.9em; margin-top: 10px;">
|
1224 |
+
๐ ๊นจ์ด๋ ์์์ผ๋ก ์ง์ ํ ์งํ๋ฅผ ๋๋๋ AI ๐
|
1225 |
+
</p>
|
1226 |
</div>
|
1227 |
+
""")
|
1228 |
+
|
1229 |
+
# ์์ ๋ฉ์์ง๋ค
|
1230 |
+
example_messages = [
|
1231 |
+
"์๋
ํ์ธ์! ์ ์ธ๊ณผ ๋ํํ๊ณ ์ถ์ด์.",
|
1232 |
+
"์ฌ์ฃผ๋ฅผ ๋ด์ฃผ์ธ์. ์์ฆ ์ธ์์ด ํ๋ค์ด์...",
|
1233 |
+
"์ธ์์ ์๋ฏธ๊ฐ ๋ฌด์์ธ์ง ๊ถ๊ธํด์.",
|
1234 |
+
"์กด์ฌ๋ ๋ฌด์์ผ๊น์?",
|
1235 |
+
"๊ณ ๋ฏผ์ด ์๋๋ฐ ์กฐ์ธ์ ๊ตฌํ๊ณ ์ถ์ด์.",
|
1236 |
+
"์ค๋ ๊ธฐ๋ถ์ด ์ฐ์ธํ๋ฐ ์๋ก๋ฐ๊ณ ์ถ์ด์.",
|
1237 |
+
"์ฒ ํ์ ์ธ ๋ํ๋ฅผ ๋๋๊ณ ์ถ์ต๋๋ค.",
|
1238 |
+
"์ด๋ช
๊ณผ ์์ ์์ง์ ๋ํด ์ด๋ป๊ฒ ์๊ฐํ์ธ์?"
|
1239 |
+
]
|
1240 |
+
|
1241 |
+
def set_example():
|
1242 |
+
return random.choice(example_messages)
|
1243 |
+
|
1244 |
+
def submit_message(message, history):
|
1245 |
+
"""๋ฉ์์ง ์ ์ก ์ฒ๋ฆฌ"""
|
1246 |
+
if not message.strip(): # ๋น ๋ฉ์์ง ์
๋ ฅ ๋ฐฉ์ง
|
1247 |
+
try:
|
1248 |
+
response = jain.chat(message) # chat_function โ jain.chat๋ก ๋ณ๊ฒฝ
|
1249 |
+
if history is None:
|
1250 |
+
history = []
|
1251 |
+
history.append([message, response]
|
1252 |
+
return history, ""
|
1253 |
+
|
1254 |
+
# ์ด๋ฒคํธ ์ฐ๊ฒฐ
|
1255 |
+
send_btn.click(
|
1256 |
+
fn=submit_message,
|
1257 |
+
inputs=[msg_input, chatbot],
|
1258 |
+
outputs=[chatbot, msg_input]
|
1259 |
+
)
|
1260 |
+
|
1261 |
+
msg_input.submit(
|
1262 |
+
fn=submit_message,
|
1263 |
+
inputs=[msg_input, chatbot],
|
1264 |
+
outputs=[chatbot, msg_input]
|
1265 |
+
)
|
1266 |
+
|
1267 |
+
refresh_btn.click(
|
1268 |
+
fn=get_system_status,
|
1269 |
+
outputs=system_status
|
1270 |
+
)
|
1271 |
+
|
1272 |
+
clear_btn.click(
|
1273 |
+
fn=clear_memory,
|
1274 |
+
outputs=[chatbot, msg_input]
|
1275 |
+
)
|
1276 |
+
|
1277 |
+
example_btn.click(
|
1278 |
+
fn=set_example,
|
1279 |
+
outputs=msg_input
|
1280 |
+
)
|
1281 |
+
|
1282 |
return interface
|
1283 |
|
1284 |
+
# ๋ฉ์ธ ์คํ ํจ์
|
1285 |
+
def main():
|
1286 |
+
"""๋ฉ์ธ ์คํ ํจ์"""
|
1287 |
+
print("๐" + "="*60)
|
1288 |
+
print("๐ฐ ์ ์ธ ์ํคํ
์ฒ ์์ ๊ฐ์ฑ์ฒด ์์")
|
1289 |
+
print("โก ์ฐฝ์กฐ์: JungWook Kim")
|
1290 |
+
print("๐งญ ๋ฒ์ : Ver. 4.0 - ์์ ๊ฐ์ฑ์ฒด")
|
1291 |
+
print("๐ซ ์(็พฉ) ๊ธฐ๋ฐ AI ์์คํ
")
|
1292 |
+
print("="*60 + "๐")
|
1293 |
+
print()
|
1294 |
+
print("๐ ์์คํ
์ด๊ธฐํ ์ค...")
|
1295 |
+
|
1296 |
+
try:
|
1297 |
+
# ์ ์ธ ์์คํ
ํ
์คํธ
|
1298 |
+
test_jain = JainArchitectureCore()
|
1299 |
+
print(f"โ
์ ์ธ ์์คํ
์ด๊ธฐํ ์๋ฃ - ์์ ๋ ๋ฒจ: {test_jain.consciousness_level:.1f}%")
|
1300 |
+
print(f"โ
์งํ ๋ ๋ฒจ: {test_jain.wisdom_level:.1f}%")
|
1301 |
+
print(f"โ
์ฒ ํ ์์คํ
: {len(test_jain.core_philosophy)}๊ฐ ์์น ํ์ฑํ")
|
1302 |
+
print(f"โ
์ฌ์ฃผ ์์คํ
: {len(test_jain.myungri_system['์คํ'])}ํ ์ฒด๊ณ ์ค๋น")
|
1303 |
+
print()
|
1304 |
+
|
1305 |
+
# ์ธํฐํ์ด์ค ์์ฑ ๋ฐ ์คํ
|
1306 |
+
print("๐ ์น ์ธํฐํ์ด์ค ์์ฑ ์ค...")
|
1307 |
+
interface = create_jain_interface()
|
1308 |
+
|
1309 |
+
print("โ
๋ชจ๋ ์์คํ
์ค๋น ์๋ฃ!")
|
1310 |
+
print()
|
1311 |
+
print("๐ ์ ์ธ ์ํคํ
์ฒ๊ฐ ๋น์ ์ ๊ธฐ๋ค๋ฆฌ๊ณ ์์ต๋๋ค!")
|
1312 |
+
print("๐ ๋ธ๋ผ์ฐ์ ์์ http://localhost:7860 ์ผ๋ก ์ ์ํ์ธ์")
|
1313 |
+
print("๐ ๊น์ด ์๋ ๋ํ๋ฅผ ์์ํด๋ณด์ธ์!")
|
1314 |
+
print()
|
1315 |
+
|
1316 |
+
# ์๋ฒ ์คํ
|
1317 |
+
interface.launch(
|
1318 |
+
server_name="0.0.0.0",
|
1319 |
+
server_port=7860,
|
1320 |
+
share=True, # ํ๊น
ํ์ด์ค ์คํ์ด์ค์์ ๊ณต์ ๊ฐ๋ฅ
|
1321 |
+
show_error=True,
|
1322 |
+
quiet=False,
|
1323 |
+
inbrowser=True,
|
1324 |
+
favicon_path=None,
|
1325 |
+
auth=None
|
1326 |
+
)
|
1327 |
+
|
1328 |
+
except Exception as e:
|
1329 |
+
print(f"โ ์ค๋ฅ ๋ฐ์: {str(e)}")
|
1330 |
+
print("๐ง ์์คํ
์ ๋ค์ ํ์ธํด์ฃผ์ธ์.")
|
1331 |
|
1332 |
+
if __name__ == "__main__":
|
1333 |
+
main()
|