Spaces:
Runtime error
Runtime error
app.py
CHANGED
@@ -1,7 +1,11 @@
|
|
1 |
-
from annotated_text import annotated_text
|
2 |
import streamlit as st
|
3 |
import openai
|
4 |
-
import
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
# OpenAI API ์ค์ (ํ๊ฒฝ ๋ณ์์์ ์ฝ์ด์ด)
|
7 |
openai.api_key = os.getenv("OPENAI_API_KEY") # ์ค์ ์ฝ๋์์ ์ฃผ์ ํด์
|
@@ -10,6 +14,12 @@ st.set_page_config(layout="wide")
|
|
10 |
|
11 |
col, _ = st.columns(2)
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
def display_passage(col):
|
14 |
st.header("์ง๋ฌธ")
|
15 |
global text_container
|
@@ -17,16 +27,10 @@ def display_passage(col):
|
|
17 |
# ๋ฏธ๋ฆฌ ๊ณต๊ฐ ํ๋ณด
|
18 |
global text_placeholder
|
19 |
text_placeholder = text_container.empty()
|
20 |
-
global
|
21 |
-
|
22 |
-
์ ๊ฑฐ ํฌํ ์ ๋์๋ ํฌํ๊ถ ํ์ฌ๋ฅผ ํฌํ์์ ์์ ์์ฌ์ ๋งก๊ธฐ๋ โ์์ ํฌํ์ โ์ ํฌํ๊ถ ํ์ฌ๋ฅผ ๊ตญ๋ฏผ์ ์๋ฌด๋ก ๊ฐ์ฃผํ๊ณ ์ ๋นํ ์ฌ์ ์์ด ๊ธฐ๊ถํ๋ฉด ๋ฒ์ ์ ์ฌ๋ฅผ ๊ฐํ๋ โ์๋ฌด ํฌํ์ โ๊ฐ ์๋ค. ์ฐ๋ฆฌ๋๋ผ๋ ์์ ํฌํ์ ๋ฅผ ์ฑํํ๊ณ ์๋๋ฐ, ์ต๊ทผ ์น๋ฅธ ์ ๊ฑฐ์ ํ๊ท ํฌํ์จ์ด 50ํผ์ผํธ๋๋ก ๋ํ๋ฌ๋ค. ๊ฒฝ์ ๊ฐ๋ฐ ํ๋ ฅ ๊ธฐ๊ตฌ(OECD) ํ์๊ตญ ํ๊ท ์ด 70ํผ์ผํธ๋์ธ ๊ฒ์ ์๊ฐํ๋ฉด ๋งค์ฐ ๋ฎ์ ์์น๋ผ ํ ์ ์๋ค. ์ด๋ฌํ ์ํฉ์ด ์ง์๋์ ์๋ฌด ํฌํ์ ๋ฅผ ๋์
ํด์ผ ํ๋ค๋ ์๊ฒฌ์ด ์ ์๋์๊ณ , ์์ ํฌํ์ ๊ฐ ๋ฏผ์ฃผ์ฃผ์์ ์์น์ ๋ง์ผ๋ฏ๋ก ์ด๋ฅผ ์ ์งํด์ผ ํ๋ค๋ ์๊ฒฌ๊ณผ ๋๋ฆฝํ๊ณ ์๋ค.
|
23 |
-
์๋ฌด ํฌํ์ ๋ฅผ ๋์
ํ์๋ ์ธก์ ๋ฎ์ ํฌํ์จ๋ก ํฌํ ๊ฒฐ๊ณผ์ ์ ๋น์ฑ์ ํ๋ณดํ์ง ๋ชปํ๋ ๋ฌธ์ ๊ฐ ๋งค์ฐ ์ฌ๊ฐํ๋ค๊ณ ์ฃผ์ฅํ๋ค. ๋ ์๋ฌด ํฌํ์ ์ ๊ฐ์ ์ฑ๊ณผ ๋ฒ์ ์ ์ฌ๊ฐ ํฌํ์จ์ ๋์ด๋ฏ๋ก ํฌํ์จ์ด ๋ฎ์์ ๋ฐ์ํ๋ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์๋ค๊ณ ๋ณธ๋ค. ๊ทธ๋ฆฌ๊ณ ๊ตญ๋ฏผ ๋๋ถ๋ถ์ด ํฌํ์ ์ฐธ์ฌํ๊ฒ ๋๋ฉด ์ ์น์ธ๋ค์ด ๋ชจ๋ ๊ณ์ธต์ ์ง์ง๋ฅผ ๋ฐ๊ธฐ ์ํด ์ ์ฑ
๊ฒฝ์๋ ฅ์ ๋์ด๋ ค ํ ๊ฒ์ด๋ฏ๋ก ์ ์น ์์ธ ๊ณ์ธต์ ๋์ฑ ๊ด์ฌ์ ์๋ ํจ๊ณผ๊ฐ ์์ ๏ฟฝ๏ฟฝ์ด๋ผ๊ณ ์ด์ผ๊ธฐํ๋ค.
|
24 |
-
๋ฐ๋ฉด ์๋ฌด ํฌํ์ ์ ๋ฐ๋ํ๋ ์ธก์ ํ์ฌ ์ฐ๋ฆฌ๋๋ผ์ ํฌํ์จ์ด ์ ์น ์ง๋์๋ค์ ๋ํ์ฑ์ ํผ์ํ ๋งํผ ์ฌ๊ฐํ ์ํฉ์ ์๋๋ผ๊ณ ์ฃผ์ฅํ๋ค. ๋ ํฌํ์จ์ ๋์ด๋ ๊ฒ๋ณด๋ค ๊ตญ๋ฏผ์ ์ ๋ขฐ๋ฅผ ํ๋ณตํ๋ ๊ฒ์ด ๋ ์ค์ํ๊ณ , ์๋ฏผ ๊ต์ก์ด๋ ๋ชจ์ ํฌํ ๊ต์ก ํ๋ก๊ทธ๋จ์ผ๋ก๋ ํฌํ์จ ์์น์ ๊ธฐ๋ํ ์ ์๋ค๋ฉฐ ์๋ฌด ํฌํ์ ์ ๋์
๋ง์ด ํฌํ์จ์ด๋ ์ ์น์ ๊ด์ฌ์ ๋์ด๋ ํด๊ฒฐ ๋ฐฉ์์ ์๋๋ผ๊ณ ์ด์ผ๊ธฐํ๋ค. ๊ทธ๋ฆฌ๊ณ ์๋ฌด ํฌํ์ ๋ฅผ ๋์
ํ๋ฉด, ์ ์ถ๋ ์ ์น์ธ๋ค์ด ๋์ ํฌํ์จ์ ํ๊ณ๋ก ์ํ๋ฌด์ธ์ ํ๋๋ฅผ ๊ฐ๋ ๋ถ์์ฉ์ด ์๊ธด๋ค๋ ๊ฐ ํ๋ณด์๋ฅผ ์ ๋ชจ๋ฅด๋ ์ํ์์ ํฌํํ๋ ์ผ์ด ๋ฐ์ํ์ฌ ๊ตญ๋ฏผ์ ๋ป์ด ์คํ๋ ค ์๊ณก๋ ์ ์๋ค๋ฉฐ ์ฐ๋ ค์ ๋ชฉ์๋ฆฌ๋ฅผ ๋ด๊ณ ์๋ค.
|
25 |
-
"""
|
26 |
-
text_placeholder.write(user_text)
|
27 |
#์ ์ธํ ๋ณ์ ๋ค๋ฅธ ํจ์์์ ์ฌ์ฉ๊ฐ๋ฅํ๊ฒ ํ๊ธฐ ์ํด return
|
28 |
-
return text_placeholder, text_container,
|
29 |
-
|
30 |
|
31 |
def display_summary(col):
|
32 |
st.header("์์ฝ ๊ฒฐ๊ณผ")
|
@@ -68,44 +72,16 @@ def display_input_btns(col):
|
|
68 |
global user_input
|
69 |
user_input = st.text_area("๋ด์ฉ์ ๋ฃ๊ณ ๋ฒํผ์ ๋๋ฌ์ฃผ์ธ์:", "")
|
70 |
st.write(user_input)
|
71 |
-
|
72 |
# ๋ฒํผ row
|
73 |
cols = st.columns(4)
|
74 |
with cols[0]:
|
75 |
btn_keyword = st.button("ํค์๋ ์ฐพ๊ธฐ")
|
76 |
if btn_keyword:
|
77 |
# ํค์๋ ์ฐพ๊ธฐ ๋ก์ง
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
("is", ""),
|
82 |
-
" some ",
|
83 |
-
("annotated", ""),
|
84 |
-
("text", ""),
|
85 |
-
" for those of ",
|
86 |
-
("you", ""),
|
87 |
-
" who ",
|
88 |
-
("like", ""),
|
89 |
-
" this sort of ",
|
90 |
-
("thing", ""),
|
91 |
-
". "
|
92 |
-
)"""
|
93 |
-
|
94 |
-
user_prompt = f"First, extract key words for the topic st-annotated-text format.: {user_text}"
|
95 |
-
|
96 |
-
messages = [{"role": "system", "content": task_description}, {"role": "user", "content": user_prompt}]
|
97 |
-
|
98 |
-
response = openai.ChatCompletion.create(
|
99 |
-
model="gpt-3.5-turbo-16k",
|
100 |
-
messages=messages,
|
101 |
-
temperature=0.1,
|
102 |
-
max_tokens=2500,
|
103 |
-
top_p=0.2,
|
104 |
-
frequency_penalty=0,
|
105 |
-
presence_penalty=0
|
106 |
-
)
|
107 |
-
|
108 |
-
highlighted_text = response['choices'][0]['message']['content']
|
109 |
|
110 |
# ๊ธฐ์กด ์ง๋ฌธ ์ง์ฐ๊ธฐ
|
111 |
text_placeholder.empty()
|
@@ -129,12 +105,11 @@ def display_input_btns(col):
|
|
129 |
|
130 |
return btn_keyword, btn_explanation, btn_simple, btn_rewrite
|
131 |
|
132 |
-
|
133 |
def display_output():
|
134 |
with st.container():
|
135 |
st.header("๊ฒฐ๊ณผ")
|
136 |
if btn_explanation:
|
137 |
-
explanation_task = f"Explain the term '{user_input}' in a simple manner, based on the context of the following passage: {
|
138 |
|
139 |
messages = [
|
140 |
{"role": "system", "content": "You are a helpful assistant that explains complex topics in a way that an elementary school student can understand. use only korean"},
|
@@ -155,7 +130,7 @@ def display_output():
|
|
155 |
pass
|
156 |
|
157 |
if btn_simple:
|
158 |
-
explanation_task = f"Describe the fingerprint of '{
|
159 |
|
160 |
messages = [
|
161 |
{"role": "system", "content": "You are a helpful assistant that explains complex topics in a way that an elementary school student can understand. use only korean"},
|
@@ -195,21 +170,48 @@ def display_output():
|
|
195 |
st.write(f"๋ค์ ์ฐ๊ธฐ: {explanation}")
|
196 |
|
197 |
#๊ฒฐ๊ณผ ๋ถ๋ถ์ ๋ฒํผ ์ถ๋ ฅ ์ถ๊ฐ
|
198 |
-
|
199 |
|
200 |
def main():
|
201 |
st.title("ํ๊ตญ์ด ํ์ต์๋ฅผ ์ํ HCI tools")
|
202 |
|
203 |
col1, col2 = st.columns(2)
|
204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
with col1:
|
206 |
display_passage(col1)
|
207 |
display_summary(col1)
|
|
|
208 |
with col2:
|
209 |
btn_keyword, btn_explanation, btn_simple, btn_rewrite = display_input_btns(col2)
|
210 |
display_output()
|
211 |
|
212 |
-
|
213 |
# # ํ๋จ ์ปจํ
์ด๋
|
214 |
# with st.container():
|
215 |
# st.header("๊ฒฐ๊ณผ")
|
|
|
|
|
1 |
import streamlit as st
|
2 |
import openai
|
3 |
+
from gpt_based_function import gpt_keyw_extractor
|
4 |
+
import os, sys
|
5 |
+
|
6 |
+
# current_path = '/Users/kintch/PycharmProjects/jungu_sgi/keyword_konan'
|
7 |
+
# os.chdir(current_path)
|
8 |
+
# sys.path.append(current_path)
|
9 |
|
10 |
# OpenAI API ์ค์ (ํ๊ฒฝ ๋ณ์์์ ์ฝ์ด์ด)
|
11 |
openai.api_key = os.getenv("OPENAI_API_KEY") # ์ค์ ์ฝ๋์์ ์ฃผ์ ํด์
|
|
|
14 |
|
15 |
col, _ = st.columns(2)
|
16 |
|
17 |
+
preset_learning_text = """๋ฏผ์ฃผ์ฃผ์ ์ฌํ๋ ๊ตญ๋ฏผ์ด ์ ์น์ ์ฐธ์ฌํ ๊ถ๋ฆฌ๋ฅผ ๋ณด์ฅํ๋ค. ๊ทธ๋ฌํ ๊ถ๋ฆฌ๋ฅผ ์ฐธ์ ๊ถ์ด๋ผ ํ๋๋ฐ, ์ด๋ ๊ธฐ๋ณธ์ ์ผ๋ก โ์ ๊ฑฐโ๋ก ์คํ๋๋ค. ์ ๊ฑฐ๋ ์ฌํ ์ง๋จ์ ๋ํ์๋ ๊ณต์ง์๋ฅผ ์ ์ถํ์ฌ ๊ทธ๋ค์๊ฒ ๋ํ์ฑ์ ๋ถ์ฌํ๋ ํ์์ด๋ค. ๊ทธ๋ฌ๋ฏ๋ก ๋์ ํฌํ์จ์ ๋ฏผ์ฃผ์ฃผ์์ ์ ๋น์ฑ ํ๋ณด์ ๊น์ ๊ด๋ จ์ด ์๋ค.
|
18 |
+
์ ๊ฑฐ ํฌํ ์ ๋์๋ ํฌํ๊ถ ํ์ฌ๋ฅผ ํฌํ์์ ์์ ์์ฌ์ ๋งก๊ธฐ๋ โ์์ ํฌํ์ โ์ ํฌํ๊ถ ํ์ฌ๋ฅผ ๊ตญ๋ฏผ์ ์๋ฌด๋ก ๊ฐ์ฃผํ๊ณ ์ ๋นํ ์ฌ์ ์์ด ๊ธฐ๊ถํ๋ฉด ๋ฒ์ ์ ์ฌ๋ฅผ ๊ฐํ๋ โ์๋ฌด ํฌํ์ โ๊ฐ ์๋ค. ์ฐ๋ฆฌ๋๋ผ๋ ์์ ํฌํ์ ๋ฅผ ์ฑํํ๊ณ ์๋๋ฐ, ์ต๊ทผ ์น๋ฅธ ์ ๊ฑฐ์ ํ๊ท ํฌํ์จ์ด 50ํผ์ผํธ๋๋ก ๋ํ๋ฌ๋ค. ๊ฒฝ์ ๊ฐ๋ฐ ํ๋ ฅ ๊ธฐ๊ตฌ(OECD) ํ์๊ตญ ํ๊ท ์ด 70ํผ์ผํธ๋์ธ ๊ฒ์ ์๊ฐํ๋ฉด ๋งค์ฐ ๋ฎ์ ์์น๋ผ ํ ์ ์๋ค. ์ด๋ฌํ ์ํฉ์ด ์ง์๋์ ์๋ฌด ํฌํ์ ๋ฅผ ๋์
ํด์ผ ํ๋ค๋ ์๊ฒฌ์ด ์ ์๋์๊ณ , ์์ ํฌํ์ ๊ฐ ๋ฏผ์ฃผ์ฃผ์์ ์์น์ ๋ง์ผ๋ฏ๋ก ์ด๋ฅผ ์ ์งํด์ผ ํ๋ค๋ ์๊ฒฌ๊ณผ ๋๋ฆฝํ๊ณ ์๋ค.
|
19 |
+
์๋ฌด ํฌํ์ ๋ฅผ ๋์
ํ์๋ ์ธก์ ๋ฎ์ ํฌํ์จ๋ก ํฌํ ๊ฒฐ๊ณผ์ ์ ๋น์ฑ์ ํ๋ณดํ์ง ๋ชปํ๋ ๋ฌธ์ ๊ฐ ๋งค์ฐ ์ฌ๊ฐํ๋ค๊ณ ์ฃผ์ฅํ๋ค. ๋ ์๋ฌด ํฌํ์ ์ ๊ฐ์ ์ฑ๊ณผ ๋ฒ์ ์ ์ฌ๊ฐ ํฌํ์จ์ ๋์ด๋ฏ๋ก ํฌํ์จ์ด ๋ฎ์์ ๋ฐ์ํ๋ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์๋ค๊ณ ๋ณธ๋ค. ๊ทธ๋ฆฌ๊ณ ๊ตญ๋ฏผ ๋๋ถ๋ถ์ด ํฌํ์ ์ฐธ์ฌํ๊ฒ ๋๋ฉด ์ ์น์ธ๋ค์ด ๋ชจ๋ ๊ณ์ธต์ ์ง์ง๋ฅผ ๋ฐ๊ธฐ ์ํด ์ ์ฑ
๊ฒฝ์๋ ฅ์ ๋์ด๋ ค ํ ๊ฒ์ด๋ฏ๋ก ์ ์น ์์ธ ๊ณ์ธต์ ๋์ฑ ๊ด์ฌ์ ์๋ ํจ๊ณผ๊ฐ ์์ ๊ฒ์ด๋ผ๊ณ ์ด์ผ๊ธฐํ๋ค.
|
20 |
+
๋ฐ๋ฉด ์๋ฌด ํฌํ์ ์ ๋ฐ๋ํ๋ ์ธก์ ํ์ฌ ์ฐ๋ฆฌ๋๋ผ์ ํฌํ์จ์ด ์ ์น ์ง๋์๋ค์ ๋ํ์ฑ์ ํผ์ํ ๋งํผ ์ฌ๊ฐํ ์ํฉ์ ์๋๋ผ๊ณ ์ฃผ์ฅํ๋ค. ๋ ํฌํ์จ์ ๋์ด๋ ๊ฒ๋ณด๋ค ๊ตญ๋ฏผ์ ์ ๋ขฐ๋ฅผ ํ๋ณตํ๋ ๊ฒ์ด ๋ ์ค์ํ๊ณ , ์๋ฏผ ๊ต์ก์ด๋ ๋ชจ์ ํฌํ ๊ต์ก ํ๋ก๊ทธ๋จ์ผ๋ก๋ ํฌํ์จ ์์น์ ๊ธฐ๋ํ ์ ์๋ค๋ฉฐ ์๋ฌด ํฌํ์ ์ ๋์
๋ง์ด ํฌํ์จ์ด๋ ์ ์น์ ๊ด์ฌ์ ๋์ด๋ ํด๊ฒฐ ๋ฐฉ์์ ์๋๋ผ๊ณ ์ด์ผ๊ธฐํ๋ค. ๊ทธ๋ฆฌ๊ณ ์๋ฌด ํฌํ์ ๋ฅผ ๋์
ํ๋ฉด, ์ ์ถ๋ ์ ์น์ธ๋ค์ด ๋์ ํฌํ์จ์ ํ๊ณ๋ก ์ํ๋ฌด์ธ์ ํ๋๋ฅผ ๊ฐ๋ ๋ถ์์ฉ์ด ์๊ธด๋ค๋ ๊ฐ ํ๋ณด์๋ฅผ ์ ๋ชจ๋ฅด๋ ์ํ์์ ํฌํํ๋ ์ผ์ด ๋ฐ์ํ์ฌ ๊ตญ๋ฏผ์ ๋ป์ด ์คํ๋ ค ์๊ณก๋ ์ ์๋ค๋ฉฐ ์ฐ๋ ค์ ๋ชฉ์๋ฆฌ๋ฅผ ๋ด๊ณ ์๋ค.
|
21 |
+
"""
|
22 |
+
|
23 |
def display_passage(col):
|
24 |
st.header("์ง๋ฌธ")
|
25 |
global text_container
|
|
|
27 |
# ๋ฏธ๋ฆฌ ๊ณต๊ฐ ํ๋ณด
|
28 |
global text_placeholder
|
29 |
text_placeholder = text_container.empty()
|
30 |
+
global preset_learning_text
|
31 |
+
text_placeholder.write(preset_learning_text)
|
|
|
|
|
|
|
|
|
|
|
32 |
#์ ์ธํ ๋ณ์ ๋ค๋ฅธ ํจ์์์ ์ฌ์ฉ๊ฐ๋ฅํ๊ฒ ํ๊ธฐ ์ํด return
|
33 |
+
return text_placeholder, text_container, preset_learning_text
|
|
|
34 |
|
35 |
def display_summary(col):
|
36 |
st.header("์์ฝ ๊ฒฐ๊ณผ")
|
|
|
72 |
global user_input
|
73 |
user_input = st.text_area("๋ด์ฉ์ ๋ฃ๊ณ ๋ฒํผ์ ๋๋ฌ์ฃผ์ธ์:", "")
|
74 |
st.write(user_input)
|
75 |
+
global highlighted_texts_list
|
76 |
# ๋ฒํผ row
|
77 |
cols = st.columns(4)
|
78 |
with cols[0]:
|
79 |
btn_keyword = st.button("ํค์๋ ์ฐพ๊ธฐ")
|
80 |
if btn_keyword:
|
81 |
# ํค์๋ ์ฐพ๊ธฐ ๋ก์ง
|
82 |
+
# highlighted_text = gpt_keyw_extractor(preset_learning_text) # Should Be DELETED
|
83 |
+
|
84 |
+
highlighted_text = highlighted_texts_list[-1]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
# ๊ธฐ์กด ์ง๋ฌธ ์ง์ฐ๊ธฐ
|
87 |
text_placeholder.empty()
|
|
|
105 |
|
106 |
return btn_keyword, btn_explanation, btn_simple, btn_rewrite
|
107 |
|
|
|
108 |
def display_output():
|
109 |
with st.container():
|
110 |
st.header("๊ฒฐ๊ณผ")
|
111 |
if btn_explanation:
|
112 |
+
explanation_task = f"Explain the term '{user_input}' in a simple manner, based on the context of the following passage: {preset_learning_text}"
|
113 |
|
114 |
messages = [
|
115 |
{"role": "system", "content": "You are a helpful assistant that explains complex topics in a way that an elementary school student can understand. use only korean"},
|
|
|
130 |
pass
|
131 |
|
132 |
if btn_simple:
|
133 |
+
explanation_task = f"Describe the fingerprint of '{preset_learning_text}' in a way that an elementary school student could understand."
|
134 |
|
135 |
messages = [
|
136 |
{"role": "system", "content": "You are a helpful assistant that explains complex topics in a way that an elementary school student can understand. use only korean"},
|
|
|
170 |
st.write(f"๋ค์ ์ฐ๊ธฐ: {explanation}")
|
171 |
|
172 |
#๊ฒฐ๊ณผ ๋ถ๋ถ์ ๋ฒํผ ์ถ๋ ฅ ์ถ๊ฐ
|
|
|
173 |
|
174 |
def main():
|
175 |
st.title("ํ๊ตญ์ด ํ์ต์๋ฅผ ์ํ HCI tools")
|
176 |
|
177 |
col1, col2 = st.columns(2)
|
178 |
|
179 |
+
## ์์ํ๊ธฐ ๋ฒํผ ์ถ๊ฐ
|
180 |
+
btn_start = st.button("์์ํ๊ธฐ")
|
181 |
+
if btn_start:
|
182 |
+
# ํค์๋ ์ฐพ๊ธฐ ์คํํด์ ๋ณ์์ keep
|
183 |
+
# preset_keyw_func(preset_learning_texts)
|
184 |
+
global preset_learning_text
|
185 |
+
preset_learning_texts = preset_learning_text.split("\n")
|
186 |
+
|
187 |
+
global highlighted_texts_list
|
188 |
+
highlighted_texts_list = list()
|
189 |
+
tmp = str()
|
190 |
+
for k in range(len(preset_learning_texts)):
|
191 |
+
print(k)
|
192 |
+
text = preset_learning_texts[k]
|
193 |
+
if tmp:
|
194 |
+
|
195 |
+
if len(text) > 15:
|
196 |
+
front_bared_htext = preset_learning_texts[k][15:] #15 = len('annotated_text(')
|
197 |
+
tmp = tmp[:-1] + front_bared_htext
|
198 |
+
else:
|
199 |
+
break # ์ด ๋ฌธ๋จ์ == len(highlighted_text_list)-1
|
200 |
+
else:
|
201 |
+
tmp += text
|
202 |
+
highlighted_texts_list.append(gpt_keyw_extractor(tmp))
|
203 |
+
|
204 |
+
# ์ฌ์ด ํํ ์คํํด์ ๋ณ์์ keep
|
205 |
+
pass
|
206 |
+
|
207 |
with col1:
|
208 |
display_passage(col1)
|
209 |
display_summary(col1)
|
210 |
+
|
211 |
with col2:
|
212 |
btn_keyword, btn_explanation, btn_simple, btn_rewrite = display_input_btns(col2)
|
213 |
display_output()
|
214 |
|
|
|
215 |
# # ํ๋จ ์ปจํ
์ด๋
|
216 |
# with st.container():
|
217 |
# st.header("๊ฒฐ๊ณผ")
|