mlo0ollm commited on
Commit
a0942f4
โ€ข
1 Parent(s): 62ec04b

apply keyword's parallel processing

Browse files
Files changed (1) hide show
  1. app.py +5 -13
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 = "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"
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
- if tmp:
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: