Spaces:
Runtime error
Runtime error
apply keyword's parallel processing
Browse files
app.py
CHANGED
@@ -12,8 +12,7 @@ from tqdm import tqdm
|
|
12 |
# sys.path.append(current_path)
|
13 |
|
14 |
# OpenAI API ์ค์ (ํ๊ฒฝ ๋ณ์์์ ์ฝ์ด์ด)
|
15 |
-
openai.api_key = "
|
16 |
-
# openai.api_key = os.getenv("OPENAI_API_KEY") # ์ค์ ์ฝ๋์์ ์ฃผ์ ํด์
|
17 |
st.set_page_config(layout="wide")
|
18 |
|
19 |
|
@@ -27,24 +26,17 @@ preset_learning_text = """๋ฏผ์ฃผ์ฃผ์ ์ฌํ๋ ๊ตญ๋ฏผ์ด ์ ์น์ ์ฐธ์ฌํ
|
|
27 |
|
28 |
# ํค์๋ ์ฐพ๊ธฐ ์คํํด์ ๋ณ์์ keep
|
29 |
# preset_keyw_func(preset_learning_texts)
|
30 |
-
preset_learning_texts = preset_learning_text.split("\n")
|
31 |
|
32 |
highlighted_texts_list = list()
|
33 |
tmp = str()
|
34 |
tmp_list = list()
|
35 |
for k in range(len(preset_learning_texts)):
|
36 |
print(k)
|
37 |
-
text = preset_learning_texts[k]
|
38 |
-
|
39 |
-
|
40 |
-
if len(text) > 15:
|
41 |
-
front_bared_htext = preset_learning_texts[k][15:] # 15 = len('annotated_text(')
|
42 |
-
tmp = tmp[:-1] + front_bared_htext
|
43 |
-
else:
|
44 |
-
break # ์ด ๋ฌธ๋จ์ == len(highlighted_text_list)-1
|
45 |
-
else:
|
46 |
-
tmp += text
|
47 |
tmp_list.append(tmp)
|
|
|
48 |
|
49 |
def run(list_sum):
|
50 |
with concurrent.futures.ThreadPoolExecutor() as executor:
|
|
|
12 |
# sys.path.append(current_path)
|
13 |
|
14 |
# OpenAI API ์ค์ (ํ๊ฒฝ ๋ณ์์์ ์ฝ์ด์ด)
|
15 |
+
openai.api_key = os.getenv("OPENAI_API_KEY") # ์ค์ ์ฝ๋์์ ์ฃผ์ ํด์
|
|
|
16 |
st.set_page_config(layout="wide")
|
17 |
|
18 |
|
|
|
26 |
|
27 |
# ํค์๋ ์ฐพ๊ธฐ ์คํํด์ ๋ณ์์ keep
|
28 |
# preset_keyw_func(preset_learning_texts)
|
29 |
+
preset_learning_texts = preset_learning_text.split("\n") #๋ฌธ๋จ๋ณ๋ก ์ชผ๊ฐ๊ธฐ
|
30 |
|
31 |
highlighted_texts_list = list()
|
32 |
tmp = str()
|
33 |
tmp_list = list()
|
34 |
for k in range(len(preset_learning_texts)):
|
35 |
print(k)
|
36 |
+
text = preset_learning_texts[k] #๋ฌธ๋จ๋ณ ํ
์คํธ
|
37 |
+
tmp += text #1๋ฌธ๋จ, 1+2๋ฌธ๋จ, 1+2+3๋ฌธ๋จ ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
tmp_list.append(tmp)
|
39 |
+
#to be updated: ํ ๋ฒ ํด๋ฆญํ ๋ ๋ง๋ค, +1 ๋ฌธ๋จ์ฉ ํค์๋ ๋ถ์ ๊ฒฐ๊ณผ ๋ณด์ฌ์ฃผ๊ธฐ
|
40 |
|
41 |
def run(list_sum):
|
42 |
with concurrent.futures.ThreadPoolExecutor() as executor:
|