Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,240 +1,155 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import time
|
| 3 |
-
from utils import tarot, prompts, llm, calculations
|
| 4 |
|
| 5 |
# --- [1. ์ฑ ์ค์ ] ---
|
| 6 |
-
st.set_page_config(page_title="AI
|
| 7 |
|
| 8 |
-
# --- [2. ํ
๋ง ์คํ์ผ๋ง
|
| 9 |
def apply_theme(mode):
|
| 10 |
-
#
|
|
|
|
| 11 |
st.markdown("""
|
| 12 |
<style>
|
| 13 |
-
@import url('https://fonts.googleapis.com/css2?family=Nanum+Myeongjo:wght@700&family=
|
| 14 |
</style>
|
| 15 |
""", unsafe_allow_html=True)
|
| 16 |
-
|
| 17 |
-
themes = {
|
| 18 |
-
"tarot": """
|
| 19 |
-
/* ๐ฎ ํ๋ก ํ
๋ง */
|
| 20 |
-
.stApp {
|
| 21 |
-
background: linear-gradient(135deg, #1a0b2e 0%, #2d1b4e 100%);
|
| 22 |
-
color: #e0d4fc;
|
| 23 |
-
}
|
| 24 |
-
h1, h2, h3 {
|
| 25 |
-
font-family: 'Nanum Myeongjo', serif;
|
| 26 |
-
color: #d4af37 !important;
|
| 27 |
-
text-shadow: 0 0 10px #d4af37;
|
| 28 |
-
}
|
| 29 |
-
.stButton>button {
|
| 30 |
-
background: linear-gradient(45deg, #4b0082, #8a2be2);
|
| 31 |
-
color: white;
|
| 32 |
-
border: 1px solid #d4af37;
|
| 33 |
-
}
|
| 34 |
-
.stTextInput>div>div>input, .stTextArea>div>div>textarea {
|
| 35 |
-
background-color: #2d1b4e;
|
| 36 |
-
color: white;
|
| 37 |
-
border: 1px solid #d4af37;
|
| 38 |
-
}
|
| 39 |
-
""",
|
| 40 |
-
"fengshui": """
|
| 41 |
-
/* ๐ก ํ์ ํ
๋ง */
|
| 42 |
-
.stApp {
|
| 43 |
-
background-color: #f5f5f0;
|
| 44 |
-
background-image: url("https://www.transparenttextures.com/patterns/rice-paper.png");
|
| 45 |
-
color: #3e2723;
|
| 46 |
-
}
|
| 47 |
-
h1, h2, h3 {
|
| 48 |
-
font-family: 'Nanum Myeongjo', serif;
|
| 49 |
-
color: #2e7d32 !important;
|
| 50 |
-
}
|
| 51 |
-
.stButton>button {
|
| 52 |
-
background-color: #5d4037;
|
| 53 |
-
color: #fff8e1;
|
| 54 |
-
border-radius: 0px;
|
| 55 |
-
}
|
| 56 |
-
.stChatMessage {
|
| 57 |
-
background-color: #ffffff;
|
| 58 |
-
border: 1px solid #d7ccc8;
|
| 59 |
-
}
|
| 60 |
-
""",
|
| 61 |
-
"shaman": """
|
| 62 |
-
/* ๐น ์ ์ง ํ
๋ง */
|
| 63 |
-
.stApp {
|
| 64 |
-
background-color: #1a0505;
|
| 65 |
-
color: #ffcccc;
|
| 66 |
-
}
|
| 67 |
-
h1, h2, h3 {
|
| 68 |
-
font-family: 'Nanum Pen Script', cursive;
|
| 69 |
-
font-size: 3.5rem !important;
|
| 70 |
-
color: #ff0000 !important;
|
| 71 |
-
text-shadow: 2px 2px 0px #ffff00;
|
| 72 |
-
}
|
| 73 |
-
.stButton>button {
|
| 74 |
-
background-color: #b71c1c;
|
| 75 |
-
color: #ffff00;
|
| 76 |
-
border: 2px solid #ffff00;
|
| 77 |
-
font-family: 'Nanum Pen Script', cursive;
|
| 78 |
-
font-size: 1.5rem;
|
| 79 |
-
}
|
| 80 |
-
.stTextInput>div>div>input {
|
| 81 |
-
background-color: #330000;
|
| 82 |
-
color: yellow;
|
| 83 |
-
border: 2px solid red;
|
| 84 |
-
}
|
| 85 |
-
"""
|
| 86 |
-
}
|
| 87 |
|
| 88 |
-
|
| 89 |
-
|
| 90 |
|
| 91 |
# --- [3. ์ํ ์ด๊ธฐํ] ---
|
| 92 |
-
if "messages" not in st.session_state:
|
| 93 |
-
|
| 94 |
-
if "
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
#
|
| 100 |
-
st.sidebar.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
selected_mode = st.sidebar.radio(
|
| 102 |
-
"
|
| 103 |
("tarot", "fengshui", "shaman"),
|
| 104 |
-
format_func=
|
| 105 |
)
|
| 106 |
|
| 107 |
-
# ํ
๋ง ์ ์ฉ ๋ฐ ํ๋ฅด์๋ ๋ก๋
|
| 108 |
apply_theme(selected_mode)
|
| 109 |
current_persona = prompts.get_persona(selected_mode)
|
| 110 |
|
| 111 |
st.sidebar.markdown("---")
|
| 112 |
-
|
| 113 |
-
st.sidebar.info(
|
| 114 |
|
| 115 |
# --- [5. ๋ฉ์ธ UI ๋ก์ง] ---
|
| 116 |
-
st.title(f"{current_persona['icon']} {
|
| 117 |
st.markdown("---")
|
| 118 |
|
| 119 |
# ==========================================
|
| 120 |
-
# ๐ ๋ชจ๋ A: ํ๋ก
|
| 121 |
# ==========================================
|
| 122 |
if selected_mode == "tarot":
|
| 123 |
-
# 1๋จ๊ณ: ์
๋ ฅ
|
| 124 |
if st.session_state.tarot_stage == "input":
|
| 125 |
with st.form("tarot_form"):
|
| 126 |
-
st.
|
| 127 |
-
|
| 128 |
-
query = st.text_area("๊ตฌ์ฒด์ ์ธ ๊ณ ๋ฏผ์ ์ ์ด์ฃผ์ธ์", placeholder="์: ์ธํ๋ ์ฌ๋์ด ์๋๋ฐ ์ฐ๋ฝ์ด ์ ์์.")
|
| 129 |
-
submitted = st.form_submit_button("์ด๋ช
์ ์นด๋ ๋ฝ์ผ๋ฌ ๊ฐ๊ธฐ")
|
| 130 |
|
| 131 |
if submitted and query:
|
| 132 |
-
st.session_state.user_query =
|
| 133 |
st.session_state.tarot_stage = "picking"
|
| 134 |
st.rerun()
|
| 135 |
|
| 136 |
-
# 2๋จ๊ณ: ๋ฝ๊ธฐ
|
| 137 |
elif st.session_state.tarot_stage == "picking":
|
| 138 |
-
st.info(f"
|
| 139 |
-
st.
|
| 140 |
-
|
| 141 |
-
with st.spinner("์ด๋ช
์ ์ ์งํ๋ ์ค..."):
|
| 142 |
time.sleep(1.5)
|
| 143 |
st.session_state.picked_cards = tarot.draw_tarot_cards(3)
|
| 144 |
st.session_state.tarot_stage = "result"
|
| 145 |
st.rerun()
|
| 146 |
|
| 147 |
-
# 3๋จ๊ณ: ๊ฒฐ๊ณผ
|
| 148 |
elif st.session_state.tarot_stage == "result":
|
| 149 |
cols = st.columns(3)
|
| 150 |
-
positions = ["๊ณผ๊ฑฐ", "ํ์ฌ", "๋ฏธ๋"]
|
| 151 |
for idx, card in enumerate(st.session_state.picked_cards):
|
| 152 |
with cols[idx]:
|
| 153 |
-
st.caption(positions[idx])
|
| 154 |
st.image(tarot.get_card_image(card["name"]), caption=card["name"])
|
| 155 |
|
| 156 |
if "ai_response" not in st.session_state:
|
| 157 |
-
with st.spinner("
|
|
|
|
| 158 |
st.session_state.ai_response = llm.get_ai_response(
|
| 159 |
-
st.session_state.user_query,
|
|
|
|
|
|
|
|
|
|
| 160 |
)
|
|
|
|
| 161 |
st.markdown(st.session_state.ai_response)
|
| 162 |
|
| 163 |
-
if st.button("๐
|
| 164 |
st.session_state.tarot_stage = "input"
|
| 165 |
del st.session_state["ai_response"]
|
| 166 |
st.rerun()
|
| 167 |
|
| 168 |
# ==========================================
|
| 169 |
-
# ๐ก ๋ชจ๋ B: ํ์์ง๋ฆฌ
|
| 170 |
# ==========================================
|
| 171 |
elif selected_mode == "fengshui":
|
| 172 |
with st.container():
|
| 173 |
-
st.info("์ ํต ๋ณธ๋ช
๊ถ๋ฒ(Life Gua)์ ์ํด ๊ทํ์ ๊ธธํ ๋ฐฉ์๋ฅผ ๊ณ์ฐํฉ๋๋ค.")
|
| 174 |
-
|
| 175 |
c1, c2 = st.columns(2)
|
| 176 |
with c1:
|
| 177 |
-
birth_year = st.number_input("
|
| 178 |
-
gender = st.radio("
|
| 179 |
with c2:
|
| 180 |
-
direction = st.selectbox("
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
if prompt := st.chat_input("๊ตฌ์กฐ์ ๋ํด ๋ฌผ์ด๋ณด์ธ์ (์: ํ๊ด์ ๊ฑฐ์ธ์ด ์์ด)"):
|
| 184 |
-
# 1. ๊ณ์ฐ ์คํ
|
| 185 |
fengshui_data = calculations.get_fengshui_info(birth_year, gender)
|
| 186 |
|
| 187 |
-
#
|
| 188 |
-
sys_msg = f""
|
| 189 |
-
|
| 190 |
-
- ๋ณธ๋ช
๊ถ: {fengshui_data['gua_number']} ({fengshui_data['group']})
|
| 191 |
-
- ๊ธธ(Good) ๋ฐฉ์: {fengshui_data['good_direction']}
|
| 192 |
-
- ํ(Bad) ๋ฐฉ์: {fengshui_data['bad_direction']}
|
| 193 |
-
- ํ์ฌ ํ๊ด: {direction}์ชฝ
|
| 194 |
-
"""
|
| 195 |
-
full_query = f"{sys_msg}\n์ฌ์ฉ์ ์ง๋ฌธ: {prompt}\n\n์ ๋ฐ์ดํฐ๋ฅผ ๊ทผ๊ฑฐ๋ก ๋
ผ๋ฆฌ์ ์ผ๋ก ์กฐ์ธํด."
|
| 196 |
|
| 197 |
with st.chat_message("user"): st.write(prompt)
|
| 198 |
with st.chat_message("assistant"):
|
| 199 |
-
with st.spinner("
|
| 200 |
-
response = llm.get_ai_response(full_query, current_persona)
|
| 201 |
st.write(response)
|
| 202 |
-
|
| 203 |
-
# ๋ถ์ํ ์ถ๋ ฅ
|
| 204 |
-
with st.expander("๐ ์ ๋ฐ ๋ถ์ํ ๋ณด๊ธฐ", expanded=True):
|
| 205 |
-
st.success(f"โ
์ถ์ฒ ๋ฐฉํฅ: {fengshui_data['good_direction']}")
|
| 206 |
-
st.error(f"๐ซ ํผํ ๋ฐฉํฅ: {fengshui_data['bad_direction']}")
|
| 207 |
|
| 208 |
# ==========================================
|
| 209 |
-
# ๐น ๋ชจ๋ C: ์ ์
|
| 210 |
# ==========================================
|
| 211 |
elif selected_mode == "shaman":
|
| 212 |
with st.container():
|
| 213 |
-
st.warning("๊ฑฐ์ง์ผ๋ก ์ ์ผ๋ฉด ์ ๊ด ์ ๋์จ๋ค! ๋๋ฐ๋ก ์ ์ด๋ผ.")
|
| 214 |
-
|
| 215 |
c1, c2 = st.columns(2)
|
| 216 |
with c1:
|
| 217 |
-
birth_year = st.number_input("
|
| 218 |
with c2:
|
| 219 |
-
prompt_input = st.text_input("
|
| 220 |
|
| 221 |
-
if st.button("
|
| 222 |
-
# 1. ์ฌ์ฃผ ๊ณ์ฐ ์คํ
|
| 223 |
saju_data = calculations.get_ganji(birth_year)
|
| 224 |
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
[๋ด๋ด์ ์ฌ์ฃผ]
|
| 228 |
-
- {saju_data['year_ganji']} ({saju_data['animal']}๋ )
|
| 229 |
-
- ํ๊ณ ๋ ๊ธฐ์ด: {saju_data['element']} ({saju_data['color']}์)
|
| 230 |
-
"""
|
| 231 |
-
full_query = f"{sys_msg}\n๊ณ ๋ฏผ: {prompt_input}\n\n๋ด๋ด์๋ '{saju_data['element']}' ๊ธฐ์ด์ด๋ค. ์ด์ ๋น๋์ด ํธํต์น๋ฉฐ ์กฐ์ธํด๋ผ."
|
| 232 |
|
| 233 |
st.divider()
|
| 234 |
-
st.
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
st.info(f"๐ ๋ช
์: **{saju_data['year_ganji']} ({saju_data['animal']})** - ๋๋ **{saju_data['element']}**์ ๊ธฐ์ด์ด์ผ!")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import time
|
| 3 |
+
from utils import tarot, prompts, llm, calculations, lang # <--- lang ์ถ๊ฐ
|
| 4 |
|
| 5 |
# --- [1. ์ฑ ์ค์ ] ---
|
| 6 |
+
st.set_page_config(page_title="Global AI Pantheon", page_icon="๐ฎ", layout="wide")
|
| 7 |
|
| 8 |
+
# --- [2. ํ
๋ง ์คํ์ผ๋ง] (๊ธฐ์กด ์ฝ๋ ์ ์ง - ์๋ต) ---
|
| 9 |
def apply_theme(mode):
|
| 10 |
+
# (์ด์ ๋ต๋ณ์ CSS ์ฝ๋ ๊ทธ๋๋ก ์ฌ์ฉํ์ธ์)
|
| 11 |
+
# ํฐํธ ๋ก๋ ๋ถ๋ถ๋ง ์กฐ๊ธ ๋ณด๊ฐํด์ ๋ค๊ตญ์ด ์ง์ํ๊ฒ
|
| 12 |
st.markdown("""
|
| 13 |
<style>
|
| 14 |
+
@import url('https://fonts.googleapis.com/css2?family=Nanum+Myeongjo:wght@700&family=Noto+Serif+SC:wght@600&family=Noto+Serif+JP:wght@600&family=Nanum+Pen+Script&display=swap');
|
| 15 |
</style>
|
| 16 |
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
# ... (๋๋จธ์ง CSS ํ
๋ง ์ฝ๋๋ ๋์ผํ๋ฏ๋ก ์๋ต) ...
|
| 19 |
+
pass
|
| 20 |
|
| 21 |
# --- [3. ์ํ ์ด๊ธฐํ] ---
|
| 22 |
+
if "messages" not in st.session_state: st.session_state.messages = []
|
| 23 |
+
if "tarot_stage" not in st.session_state: st.session_state.tarot_stage = "input"
|
| 24 |
+
if "picked_cards" not in st.session_state: st.session_state.picked_cards = []
|
| 25 |
+
|
| 26 |
+
# ==========================================
|
| 27 |
+
# ๐ ์ธ์ด ์ ํ (์ฌ์ด๋๋ฐ ์ต์๋จ)
|
| 28 |
+
# ==========================================
|
| 29 |
+
st.sidebar.markdown("### ๐ Language")
|
| 30 |
+
current_lang = st.sidebar.selectbox(
|
| 31 |
+
"Select Language",
|
| 32 |
+
["ํ๊ตญ์ด", "English", "ไธญๆ", "ๆฅๆฌ่ช"],
|
| 33 |
+
label_visibility="collapsed"
|
| 34 |
+
)
|
| 35 |
+
# ์ ํ๋ ์ธ์ด ํฉ ๊ฐ์ ธ์ค๊ธฐ
|
| 36 |
+
TXT = lang.STRINGS[current_lang]
|
| 37 |
+
|
| 38 |
+
# --- [4. ๋ชจ๋ ์ ํ UI] ---
|
| 39 |
+
st.sidebar.title(TXT["sidebar_title"])
|
| 40 |
+
|
| 41 |
+
# ํ๋ฅด์๋ ์ด๋ฆ๋ ์ธ์ด๋ณ๋ก ๋ณด์ฌ์ฃผ๊ธฐ
|
| 42 |
+
def get_persona_name(key):
|
| 43 |
+
return TXT["personas"][key]
|
| 44 |
+
|
| 45 |
selected_mode = st.sidebar.radio(
|
| 46 |
+
TXT["select_persona"],
|
| 47 |
("tarot", "fengshui", "shaman"),
|
| 48 |
+
format_func=get_persona_name
|
| 49 |
)
|
| 50 |
|
|
|
|
| 51 |
apply_theme(selected_mode)
|
| 52 |
current_persona = prompts.get_persona(selected_mode)
|
| 53 |
|
| 54 |
st.sidebar.markdown("---")
|
| 55 |
+
# ์ค๋ช
๋ ๋ฒ์ญ๋ ๊ฑธ๋ก ํ์
|
| 56 |
+
st.sidebar.info(TXT["desc"][selected_mode])
|
| 57 |
|
| 58 |
# --- [5. ๋ฉ์ธ UI ๋ก์ง] ---
|
| 59 |
+
st.title(f"{current_persona['icon']} {get_persona_name(selected_mode)}")
|
| 60 |
st.markdown("---")
|
| 61 |
|
| 62 |
# ==========================================
|
| 63 |
+
# ๐ ๋ชจ๋ A: ํ๋ก
|
| 64 |
# ==========================================
|
| 65 |
if selected_mode == "tarot":
|
|
|
|
| 66 |
if st.session_state.tarot_stage == "input":
|
| 67 |
with st.form("tarot_form"):
|
| 68 |
+
query = st.text_area(TXT["input_label"])
|
| 69 |
+
submitted = st.form_submit_button(TXT["btn_submit"])
|
|
|
|
|
|
|
| 70 |
|
| 71 |
if submitted and query:
|
| 72 |
+
st.session_state.user_query = query
|
| 73 |
st.session_state.tarot_stage = "picking"
|
| 74 |
st.rerun()
|
| 75 |
|
|
|
|
| 76 |
elif st.session_state.tarot_stage == "picking":
|
| 77 |
+
st.info(f"Your Worry: **{st.session_state.user_query}**")
|
| 78 |
+
if st.button("๐ด Draw 3 Cards", type="primary", use_container_width=True):
|
| 79 |
+
with st.spinner(TXT["loading"]):
|
|
|
|
| 80 |
time.sleep(1.5)
|
| 81 |
st.session_state.picked_cards = tarot.draw_tarot_cards(3)
|
| 82 |
st.session_state.tarot_stage = "result"
|
| 83 |
st.rerun()
|
| 84 |
|
|
|
|
| 85 |
elif st.session_state.tarot_stage == "result":
|
| 86 |
cols = st.columns(3)
|
|
|
|
| 87 |
for idx, card in enumerate(st.session_state.picked_cards):
|
| 88 |
with cols[idx]:
|
|
|
|
| 89 |
st.image(tarot.get_card_image(card["name"]), caption=card["name"])
|
| 90 |
|
| 91 |
if "ai_response" not in st.session_state:
|
| 92 |
+
with st.spinner(TXT["analyzing"]):
|
| 93 |
+
# ์ธ์ด ์ ๋ณด(current_lang)๋ฅผ ํจ๊ป ๋๊น
|
| 94 |
st.session_state.ai_response = llm.get_ai_response(
|
| 95 |
+
st.session_state.user_query,
|
| 96 |
+
current_persona,
|
| 97 |
+
st.session_state.picked_cards,
|
| 98 |
+
user_lang=current_lang
|
| 99 |
)
|
| 100 |
+
st.subheader(TXT["result_title"])
|
| 101 |
st.markdown(st.session_state.ai_response)
|
| 102 |
|
| 103 |
+
if st.button("๐ Retry"):
|
| 104 |
st.session_state.tarot_stage = "input"
|
| 105 |
del st.session_state["ai_response"]
|
| 106 |
st.rerun()
|
| 107 |
|
| 108 |
# ==========================================
|
| 109 |
+
# ๐ก ๋ชจ๋ B: ํ์์ง๋ฆฌ
|
| 110 |
# ==========================================
|
| 111 |
elif selected_mode == "fengshui":
|
| 112 |
with st.container():
|
|
|
|
|
|
|
| 113 |
c1, c2 = st.columns(2)
|
| 114 |
with c1:
|
| 115 |
+
birth_year = st.number_input("Year of Birth", 1950, 2025, 1990)
|
| 116 |
+
gender = st.radio("Gender", ["๋จ์ฑ", "์ฌ์ฑ"]) # ๊ณ์ฐ์ ๋๋ฌธ์ ๊ฐ์ ํ๊ธ๋ก ์ ์งํ๋ ํ์๋ ๋ฐ๊ฟ ์ ์์
|
| 117 |
with c2:
|
| 118 |
+
direction = st.selectbox("Door Direction", ["๋ถ", "๋ถ๋", "๋", "๋จ๋", "๋จ", "๋จ์", "์", "๋ถ์"])
|
| 119 |
+
|
| 120 |
+
if prompt := st.chat_input(TXT["input_label"]):
|
|
|
|
|
|
|
| 121 |
fengshui_data = calculations.get_fengshui_info(birth_year, gender)
|
| 122 |
|
| 123 |
+
# ์์คํ
ํ๋กฌํํธ์ฉ ๋ฐ์ดํฐ ๊ตฌ์ฑ
|
| 124 |
+
sys_msg = f"[Data]: {fengshui_data}, Current Door: {direction}"
|
| 125 |
+
full_query = f"{sys_msg}\nUser Question: {prompt}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
with st.chat_message("user"): st.write(prompt)
|
| 128 |
with st.chat_message("assistant"):
|
| 129 |
+
with st.spinner(TXT["analyzing"]):
|
| 130 |
+
response = llm.get_ai_response(full_query, current_persona, user_lang=current_lang)
|
| 131 |
st.write(response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
# ==========================================
|
| 134 |
+
# ๐น ๋ชจ๋ C: ์ ์
|
| 135 |
# ==========================================
|
| 136 |
elif selected_mode == "shaman":
|
| 137 |
with st.container():
|
|
|
|
|
|
|
| 138 |
c1, c2 = st.columns(2)
|
| 139 |
with c1:
|
| 140 |
+
birth_year = st.number_input("Birth Year", 1960, 2025, 1995)
|
| 141 |
with c2:
|
| 142 |
+
prompt_input = st.text_input(TXT["input_label"])
|
| 143 |
|
| 144 |
+
if st.button(TXT["btn_submit"]) and prompt_input:
|
|
|
|
| 145 |
saju_data = calculations.get_ganji(birth_year)
|
| 146 |
|
| 147 |
+
sys_msg = f"[Saju Data]: Year {saju_data['year_ganji']}, Element {saju_data['element']}"
|
| 148 |
+
full_query = f"{sys_msg}\nUser Worry: {prompt_input}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
|
| 150 |
st.divider()
|
| 151 |
+
with st.chat_message("user"): st.write(prompt_input)
|
| 152 |
+
with st.chat_message("assistant"):
|
| 153 |
+
with st.spinner(TXT["loading"]):
|
| 154 |
+
response = llm.get_ai_response(full_query, current_persona, user_lang=current_lang)
|
| 155 |
+
st.markdown(response)
|
|
|
|
|
|