Update app.py
Browse files
app.py
CHANGED
@@ -150,15 +150,20 @@ def suggest_title(category, style, topic, references1, references2, references3)
|
|
150 |
max_tokens = 5000
|
151 |
temperature = 0.8
|
152 |
top_p = 0.95
|
153 |
-
combined_prompt = f"{category_prompt}\n\n{style_prompt}\n\n์ถ๊ฐ ์ง์์ฌํญ: ์ ๋๋ก ์ ๋ชฉ
|
154 |
modified_text, input_tokens, output_tokens, total_tokens = call_api(full_content, combined_prompt, max_tokens, temperature, top_p)
|
155 |
|
156 |
# ๋ฒํธ์ ์ (.)์ ์ ๊ฑฐํ๊ณ ๊ฐ ์ค์ ์ ๋ฆฌํฉ๋๋ค.
|
157 |
titles = [line.strip() for line in modified_text.split('\n') if line.strip()]
|
158 |
titles = [re.sub(r'^\d+\.\s*', '', title) for title in titles]
|
159 |
|
|
|
|
|
|
|
160 |
token_usage_message = f"[์
๋ ฅ ํ ํฐ์: {input_tokens}]\n[์ถ๋ ฅ ํ ํฐ์: {output_tokens}]\n[์ด ํ ํฐ์: {total_tokens}]"
|
161 |
return "\n".join(titles), token_usage_message
|
|
|
|
|
162 |
|
163 |
def process_all_titles(category, style, topic):
|
164 |
# ์ ๋ชฉ ์ถ์ฒ
|
@@ -627,6 +632,9 @@ def process_all_titles(category, style, topic, num_titles):
|
|
627 |
|
628 |
# ๋น ๋ฌธ์์ด์ด๋ '###' ๋ฑ์ ๋ถํ์ํ ๋ฌธ์์ด ์ ๊ฑฐ
|
629 |
titles = [title.strip() for title in titles if title.strip() and not title.strip().startswith('###')]
|
|
|
|
|
|
|
630 |
|
631 |
results = []
|
632 |
for title in titles[:num_titles]:
|
|
|
150 |
max_tokens = 5000
|
151 |
temperature = 0.8
|
152 |
top_p = 0.95
|
153 |
+
combined_prompt = f"{category_prompt}\n\n{style_prompt}\n\n์ถ๊ฐ ์ง์์ฌํญ: ์ ๋๋ก ์ ๋ชฉ์ '๋ธ๋ก๊ทธ'๋ '์ ๋ชฉ'์ด๋ผ๋ ๋จ์ด๋ฅผ ํฌํจํ์ง ๋ง์ธ์. ๊ฐ ์ ์์ ์ค์ ํฌ์คํธ ์ ๋ชฉ์ผ๋ก ๋ฐ๋ก ์ฌ์ฉํ ์ ์์ด์ผ ํฉ๋๋ค."
|
154 |
modified_text, input_tokens, output_tokens, total_tokens = call_api(full_content, combined_prompt, max_tokens, temperature, top_p)
|
155 |
|
156 |
# ๋ฒํธ์ ์ (.)์ ์ ๊ฑฐํ๊ณ ๊ฐ ์ค์ ์ ๋ฆฌํฉ๋๋ค.
|
157 |
titles = [line.strip() for line in modified_text.split('\n') if line.strip()]
|
158 |
titles = [re.sub(r'^\d+\.\s*', '', title) for title in titles]
|
159 |
|
160 |
+
# "๋ธ๋ก๊ทธ"์ "์ ๋ชฉ"์ด๋ผ๋ ๋จ์ด๊ฐ ํฌํจ๋ ์ ๋ชฉ์ ์ ๊ฑฐํฉ๋๋ค.
|
161 |
+
titles = [title for title in titles if "๋ธ๋ก๊ทธ" not in title and "์ ๋ชฉ" not in title]
|
162 |
+
|
163 |
token_usage_message = f"[์
๋ ฅ ํ ํฐ์: {input_tokens}]\n[์ถ๋ ฅ ํ ํฐ์: {output_tokens}]\n[์ด ํ ํฐ์: {total_tokens}]"
|
164 |
return "\n".join(titles), token_usage_message
|
165 |
+
|
166 |
+
|
167 |
|
168 |
def process_all_titles(category, style, topic):
|
169 |
# ์ ๋ชฉ ์ถ์ฒ
|
|
|
632 |
|
633 |
# ๋น ๋ฌธ์์ด์ด๋ '###' ๋ฑ์ ๋ถํ์ํ ๋ฌธ์์ด ์ ๊ฑฐ
|
634 |
titles = [title.strip() for title in titles if title.strip() and not title.strip().startswith('###')]
|
635 |
+
|
636 |
+
# "๋ธ๋ก๊ทธ"์ "์ ๋ชฉ"์ด๋ผ๋ ๋จ์ด๊ฐ ํฌํจ๋ ์ ๋ชฉ์ ์ ๊ฑฐ
|
637 |
+
titles = [title for title in titles if "๋ธ๋ก๊ทธ" not in title and "์ ๋ชฉ" not in title]
|
638 |
|
639 |
results = []
|
640 |
for title in titles[:num_titles]:
|