Spaces:
Sleeping
Sleeping
Update article_generator.py
Browse files- article_generator.py +4 -4
article_generator.py
CHANGED
|
@@ -87,9 +87,9 @@ def generate_article(editable_output2):
|
|
| 87 |
# 特定情報の指定
|
| 88 |
if "人物" in h1_text or any("人物" in h2 for h2 in h2_texts) or any("人物" in h3 for h3 in h3_texts):
|
| 89 |
purpose += " including the person's name and career"
|
| 90 |
-
elif "商品" in h1_text or any("商品"
|
| 91 |
purpose += " including the brand name, product name, and price"
|
| 92 |
-
elif "イベント" in h1_text or any("イベント"
|
| 93 |
purpose += " including the event's content, schedule, and venue"
|
| 94 |
|
| 95 |
instruction = f"Can you research {purpose} and include specific details in your response? Please provide the information in Japanese."
|
|
@@ -130,7 +130,7 @@ def generate_article(editable_output2):
|
|
| 130 |
# 質問の数を制限
|
| 131 |
max_questions_per_h3 = 2
|
| 132 |
|
| 133 |
-
for idx, h2_text in h2_texts:
|
| 134 |
h3_for_this_h2 = [h3 for h3 in h3_texts if h3.startswith(f"{idx+1}-")]
|
| 135 |
instructions.append(f"""
|
| 136 |
<h2>{h2_text}</h2>
|
|
@@ -253,4 +253,4 @@ def continue_generate_article():
|
|
| 253 |
if os.path.exists(state_file):
|
| 254 |
os.remove(state_file)
|
| 255 |
|
| 256 |
-
return final_result
|
|
|
|
| 87 |
# 特定情報の指定
|
| 88 |
if "人物" in h1_text or any("人物" in h2 for h2 in h2_texts) or any("人物" in h3 for h3 in h3_texts):
|
| 89 |
purpose += " including the person's name and career"
|
| 90 |
+
elif "商品" in h1_text or any("商品" in h2 for h2 in h2_texts) or any("商品" in h3 for h3 in h3_texts):
|
| 91 |
purpose += " including the brand name, product name, and price"
|
| 92 |
+
elif "イベント" in h1_text or any("イベント" in h2 for h2 in h2_texts) or any("イベント" in h3 for h3 in h3_texts):
|
| 93 |
purpose += " including the event's content, schedule, and venue"
|
| 94 |
|
| 95 |
instruction = f"Can you research {purpose} and include specific details in your response? Please provide the information in Japanese."
|
|
|
|
| 130 |
# 質問の数を制限
|
| 131 |
max_questions_per_h3 = 2
|
| 132 |
|
| 133 |
+
for idx, h2_text in enumerate(h2_texts):
|
| 134 |
h3_for_this_h2 = [h3 for h3 in h3_texts if h3.startswith(f"{idx+1}-")]
|
| 135 |
instructions.append(f"""
|
| 136 |
<h2>{h2_text}</h2>
|
|
|
|
| 253 |
if os.path.exists(state_file):
|
| 254 |
os.remove(state_file)
|
| 255 |
|
| 256 |
+
return final_result
|