Update app.py
Browse files
app.py
CHANGED
|
@@ -11,6 +11,8 @@ st.set_page_config(layout="wide")
|
|
| 11 |
## ํฌ์ธํธ ๋ถ๋ถ ์ถ๊ฐ
|
| 12 |
if 'points' not in st.session_state:
|
| 13 |
st.session_state.points = 3
|
|
|
|
|
|
|
| 14 |
|
| 15 |
def update_points(value):
|
| 16 |
""" ํฌ์ธํธ ์
๋ฐ์ดํธ """
|
|
@@ -21,6 +23,15 @@ def display_points():
|
|
| 21 |
""" ํฌ์ธํธ ํ์ """
|
| 22 |
st.sidebar.header(f"Current Points: {st.session_state.points}")
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
##๊ธฐ๋ฅ์ ํจ์๋ก ๋๋์ด์ ๊ตฌํ
|
|
@@ -53,7 +64,7 @@ def display_summary(col):
|
|
| 53 |
with cols[0]:
|
| 54 |
btn_submit = st.button("์ ์ถ")
|
| 55 |
if btn_submit:
|
| 56 |
-
#๊ตฌ๊ธ ๋๋ผ์ด๋ธ api
|
| 57 |
st.write("์ ์ถ ๋์์ต๋๋ค.")
|
| 58 |
pass
|
| 59 |
|
|
@@ -61,6 +72,7 @@ def display_summary(col):
|
|
| 61 |
btn_score = st.button("์ฑ์ ํ๊ธฐ")
|
| 62 |
if btn_score and st.session_state.points > 0: # ํฌ์ธํธ ์ฒดํฌ
|
| 63 |
update_points(1) # ํฌ์ธํธ ์ฆ๊ฐ
|
|
|
|
| 64 |
#๋ฃจ๋ธ๋ฆญ์ ์ํ ์ฑ์
|
| 65 |
lubric = """์ฑ์ ๊ธฐ์ค ์: ๋ฌธ์ฅ์ ์ฃผ์ ๋ฅผ ํ์
ํ๊ณ , ์ฃผ์ ๋ด์ฉ์ ํ์
ํ ์ ์๋ค. ์ค: ๋ฌธ์ฅ์ ์ฃผ์ ๋ฅผ ํ์
ํ ์ ์๋ค. ํ: ๋ฌธ์ฅ์ ์ฃผ์ ๋ฅผ ํ์
ํ ์ ์๋ค."""
|
| 66 |
#๋ฃจ๋ธ๋ฆญ ๊ธฐ์ค์ ์ด์ฉํด์ ์
๋ ฅ์นธ์ ์
๋ ฅํ ๋ด์ฉ์ ์ฑ์ ํ๋ ์์ด๋ก ํ๋กฌํํธ
|
|
@@ -97,6 +109,7 @@ def display_input_btns(col):
|
|
| 97 |
btn_keyword = st.button("ํค์๋ ์ฐพ๊ธฐ")
|
| 98 |
if btn_keyword and st.session_state.points > 0: # ํฌ์ธํธ ์ฒดํฌ
|
| 99 |
update_points(-1) # ํฌ์ธํธ ๊ฐ์
|
|
|
|
| 100 |
#๋ค๋ฅธ ์ง๋ฌธ ๋ฃ๊ธฐ
|
| 101 |
highlighted_text = """**๋ฏผ์ฃผ์ฃผ์ ์ฌํ**๋ ๊ตญ๋ฏผ์ด ์ ์น์ ์ฐธ์ฌํ ๊ถ๋ฆฌ๋ฅผ ๋ณด์ฅํ๋ค. ๊ทธ๋ฌํ ๊ถ๋ฆฌ๋ฅผ **์ฐธ์ ๊ถ**์ด๋ผ ํ๋๋ฐ, ์ด๋ ๊ธฐ๋ณธ์ ์ผ๋ก โ์ ๊ฑฐโ๋ก ์คํ๋๋ค. ์ ๊ฑฐ๋ ์ฌํ ์ง๋จ์ ๋ํ์๋ ๊ณต์ง์๋ฅผ ์ ์ถํ์ฌ ๊ทธ๋ค์๊ฒ ๋ํ์ฑ์ ๋ถ์ฌํ๋ ํ์์ด๋ค. ๊ทธ๋ฌ๋ฏ๋ก **๋์ ํฌํ์จ**์ ๋ฏผ์ฃผ์ฃผ์์ **์ ๋น์ฑ ํ๋ณด**์ ๊น์ ๊ด๋ จ์ด ์๋ค.
|
| 102 |
|
|
@@ -126,12 +139,14 @@ def display_input_btns(col):
|
|
| 126 |
btn_explanation= st.button("์ถ๊ฐ ์ค๋ช
")
|
| 127 |
if btn_explanation and st.session_state.points > 0: # ํฌ์ธํธ ์ฒดํฌ
|
| 128 |
update_points(1) # ํฌ์ธํธ ์ฆ๊ฐ
|
|
|
|
| 129 |
|
| 130 |
with cols[2]:
|
| 131 |
global btn_simple
|
| 132 |
btn_simple = st.button("์ฌ์ด ํํ")
|
| 133 |
if btn_simple and st.session_state.points > 0: # ํฌ์ธํธ ์ฒดํฌ
|
| 134 |
update_points(-1) # ํฌ์ธํธ ๊ฐ์
|
|
|
|
| 135 |
|
| 136 |
|
| 137 |
with cols[3]:
|
|
@@ -139,6 +154,7 @@ def display_input_btns(col):
|
|
| 139 |
btn_rewrite = st.button("๋ค์ ์ฐ๊ธฐ")
|
| 140 |
if btn_rewrite and st.session_state.points > 0: # ํฌ์ธํธ ์ฒดํฌ
|
| 141 |
update_points(-1) # ํฌ์ธํธ ๊ฐ์
|
|
|
|
| 142 |
|
| 143 |
|
| 144 |
return btn_keyword, btn_explanation, btn_simple, btn_rewrite
|
|
@@ -228,7 +244,7 @@ def display_output():
|
|
| 228 |
def main():
|
| 229 |
st.title("ํ๊ตญ์ด ํ์ต์๋ฅผ ์ํ HCI tools")
|
| 230 |
#ํฌ์ธํธ ์์คํ
์ค๋ช
์ถ๊ฐ
|
| 231 |
-
st.sidebar.markdown("ํฌ์ธํธ๋ 3์ ๋ถํฐ ์์ํด์, ํค์๋ ์ฐพ๊ธฐ, ์ฌ์ด ํํ, ๋ค์ ์ฐ๊ธฐ๋ฅผ ํ ๋ 1์ ์ฉ ๊ฐ์ํฉ๋๋ค. ์ถ๊ฐ ์ค๋ช
๊ณผ ์ฑ์ ํ๊ธฐ๋ฅผ ํ ๋ 1์ ์ฉ ์ฆ๊ฐํฉ๋๋ค. ํฌ์ธํธ๊ฐ 0์ ์ด ๋๋ฉด ๋ ์ด์ ์์
์ ํ ์ ์์ต๋๋ค. ")
|
| 232 |
|
| 233 |
col1, col2 = st.columns(2)
|
| 234 |
|
|
@@ -240,6 +256,9 @@ def main():
|
|
| 240 |
display_output()
|
| 241 |
#ํฌ์ธํธ ํ์
|
| 242 |
display_points()
|
|
|
|
|
|
|
|
|
|
| 243 |
|
| 244 |
|
| 245 |
if __name__ == "__main__":
|
|
|
|
| 11 |
## ํฌ์ธํธ ๋ถ๋ถ ์ถ๊ฐ
|
| 12 |
if 'points' not in st.session_state:
|
| 13 |
st.session_state.points = 3
|
| 14 |
+
if 'history' not in st.session_state:
|
| 15 |
+
st.session_state.history = []
|
| 16 |
|
| 17 |
def update_points(value):
|
| 18 |
""" ํฌ์ธํธ ์
๋ฐ์ดํธ """
|
|
|
|
| 23 |
""" ํฌ์ธํธ ํ์ """
|
| 24 |
st.sidebar.header(f"Current Points: {st.session_state.points}")
|
| 25 |
|
| 26 |
+
def display_markdown_table():
|
| 27 |
+
"""์ง๊ธ๊น์ง ์ฌ์ฉํ ๊ธฐ๋ฅ๊ณผ ํฌ์ธํธ๋ฅผ ํ์ํ๋ ํ์คํ ๋ฆฌ ํจ์, ๊ธฐ๋ฅ์ ๋๋ฅธ ์์์ ํฌ์ธํธ ๋ณํ์ ํ์ฌ ํฌ์ธํธ๋ฅผ ํ๋ก ์ ๋ฆฌ"""
|
| 28 |
+
markdown_table = """| ์์ | ์ ํํ ๊ธฐ๋ฅ | ํฌ์ธํธ ๋ณํ | ํ์ฌ ํฌ์ธํธ |
|
| 29 |
+
| --- | --- | --- | --- |
|
| 30 |
+
"""
|
| 31 |
+
for i, step in enumerate(st.session_state.history):
|
| 32 |
+
markdown_table += f"| {i+1} | {step[0]} | {step[1]} | {step[2]} |\n"
|
| 33 |
+
st.sidebar.markdown(markdown_table)
|
| 34 |
+
|
| 35 |
|
| 36 |
|
| 37 |
##๊ธฐ๋ฅ์ ํจ์๋ก ๋๋์ด์ ๊ตฌํ
|
|
|
|
| 64 |
with cols[0]:
|
| 65 |
btn_submit = st.button("์ ์ถ")
|
| 66 |
if btn_submit:
|
| 67 |
+
#๊ตฌ๊ธ ๋๋ผ์ด๋ธ api ์ด์ฉํ์ฌ ์
๋ก๋
|
| 68 |
st.write("์ ์ถ ๋์์ต๋๋ค.")
|
| 69 |
pass
|
| 70 |
|
|
|
|
| 72 |
btn_score = st.button("์ฑ์ ํ๊ธฐ")
|
| 73 |
if btn_score and st.session_state.points > 0: # ํฌ์ธํธ ์ฒดํฌ
|
| 74 |
update_points(1) # ํฌ์ธํธ ์ฆ๊ฐ
|
| 75 |
+
st.session_state.history.append(["์ฑ์ ํ๊ธฐ", -1, st.session_state.points])
|
| 76 |
#๋ฃจ๋ธ๋ฆญ์ ์ํ ์ฑ์
|
| 77 |
lubric = """์ฑ์ ๊ธฐ์ค ์: ๋ฌธ์ฅ์ ์ฃผ์ ๋ฅผ ํ์
ํ๊ณ , ์ฃผ์ ๋ด์ฉ์ ํ์
ํ ์ ์๋ค. ์ค: ๋ฌธ์ฅ์ ์ฃผ์ ๋ฅผ ํ์
ํ ์ ์๋ค. ํ: ๋ฌธ์ฅ์ ์ฃผ์ ๋ฅผ ํ์
ํ ์ ์๋ค."""
|
| 78 |
#๋ฃจ๋ธ๋ฆญ ๊ธฐ์ค์ ์ด์ฉํด์ ์
๋ ฅ์นธ์ ์
๋ ฅํ ๋ด์ฉ์ ์ฑ์ ํ๋ ์์ด๋ก ํ๋กฌํํธ
|
|
|
|
| 109 |
btn_keyword = st.button("ํค์๋ ์ฐพ๊ธฐ")
|
| 110 |
if btn_keyword and st.session_state.points > 0: # ํฌ์ธํธ ์ฒดํฌ
|
| 111 |
update_points(-1) # ํฌ์ธํธ ๊ฐ์
|
| 112 |
+
st.session_state.history.append(["ํค์๋ ์ฐพ๊ธฐ", -1, st.session_state.points])
|
| 113 |
#๋ค๋ฅธ ์ง๋ฌธ ๋ฃ๊ธฐ
|
| 114 |
highlighted_text = """**๋ฏผ์ฃผ์ฃผ์ ์ฌํ**๋ ๊ตญ๋ฏผ์ด ์ ์น์ ์ฐธ์ฌํ ๊ถ๋ฆฌ๋ฅผ ๋ณด์ฅํ๋ค. ๊ทธ๋ฌํ ๊ถ๋ฆฌ๋ฅผ **์ฐธ์ ๊ถ**์ด๋ผ ํ๋๋ฐ, ์ด๋ ๊ธฐ๋ณธ์ ์ผ๋ก โ์ ๊ฑฐโ๋ก ์คํ๋๋ค. ์ ๊ฑฐ๋ ์ฌํ ์ง๋จ์ ๋ํ์๋ ๊ณต์ง์๋ฅผ ์ ์ถํ์ฌ ๊ทธ๋ค์๊ฒ ๋ํ์ฑ์ ๋ถ์ฌํ๋ ํ์์ด๋ค. ๊ทธ๋ฌ๋ฏ๋ก **๋์ ํฌํ์จ**์ ๋ฏผ์ฃผ์ฃผ์์ **์ ๋น์ฑ ํ๋ณด**์ ๊น์ ๊ด๋ จ์ด ์๋ค.
|
| 115 |
|
|
|
|
| 139 |
btn_explanation= st.button("์ถ๊ฐ ์ค๋ช
")
|
| 140 |
if btn_explanation and st.session_state.points > 0: # ํฌ์ธํธ ์ฒดํฌ
|
| 141 |
update_points(1) # ํฌ์ธํธ ์ฆ๊ฐ
|
| 142 |
+
st.session_state.history.append(["์ถ๊ฐ ์ค๋ช
", 1, st.session_state.points])
|
| 143 |
|
| 144 |
with cols[2]:
|
| 145 |
global btn_simple
|
| 146 |
btn_simple = st.button("์ฌ์ด ํํ")
|
| 147 |
if btn_simple and st.session_state.points > 0: # ํฌ์ธํธ ์ฒดํฌ
|
| 148 |
update_points(-1) # ํฌ์ธํธ ๊ฐ์
|
| 149 |
+
st.session_state.history.append(["์ฌ์ด ํํ", -1, st.session_state.points])
|
| 150 |
|
| 151 |
|
| 152 |
with cols[3]:
|
|
|
|
| 154 |
btn_rewrite = st.button("๋ค์ ์ฐ๊ธฐ")
|
| 155 |
if btn_rewrite and st.session_state.points > 0: # ํฌ์ธํธ ์ฒดํฌ
|
| 156 |
update_points(-1) # ํฌ์ธํธ ๊ฐ์
|
| 157 |
+
st.session_state.history.append(["๋ค์ ์ฐ๊ธฐ", -1, st.session_state.points])
|
| 158 |
|
| 159 |
|
| 160 |
return btn_keyword, btn_explanation, btn_simple, btn_rewrite
|
|
|
|
| 244 |
def main():
|
| 245 |
st.title("ํ๊ตญ์ด ํ์ต์๋ฅผ ์ํ HCI tools")
|
| 246 |
#ํฌ์ธํธ ์์คํ
์ค๋ช
์ถ๊ฐ
|
| 247 |
+
st.sidebar.markdown("ํฌ์ธํธ๋ 3์ ๋ถํฐ ์์ํด์, **ํค์๋ ์ฐพ๊ธฐ**, **์ฌ์ด ํํ**, **๋ค์ ์ฐ๊ธฐ**๋ฅผ ํ ๋ 1์ ์ฉ ๊ฐ์ํฉ๋๋ค. **์ถ๊ฐ ์ค๋ช
**๊ณผ **์ฑ์ ํ๊ธฐ**๋ฅผ ํ ๋ 1์ ์ฉ ์ฆ๊ฐํฉ๋๋ค. ํฌ์ธํธ๊ฐ 0์ ์ด ๋๋ฉด ๋ ์ด์ ์์
์ ํ ์ ์์ต๋๋ค. ")
|
| 248 |
|
| 249 |
col1, col2 = st.columns(2)
|
| 250 |
|
|
|
|
| 256 |
display_output()
|
| 257 |
#ํฌ์ธํธ ํ์
|
| 258 |
display_points()
|
| 259 |
+
#ํฌ์ธํธ ๋ณํ ํ์
|
| 260 |
+
display_markdown_table()
|
| 261 |
+
|
| 262 |
|
| 263 |
|
| 264 |
if __name__ == "__main__":
|