Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,18 +51,15 @@ def process_article(new_keyword, other_keywords, action, edited_article_structur
|
|
| 51 |
return response_text, None # 編集可能な記事構成にのみ出力
|
| 52 |
|
| 53 |
elif action == "本文作成":
|
| 54 |
-
response_text = edited_article_structure
|
| 55 |
try:
|
| 56 |
-
|
| 57 |
-
with open("editable_output2.txt", "w", encoding="utf-8") as f:
|
| 58 |
-
f.write(edited_article_structure)
|
| 59 |
-
subprocess.run(["python3", "article_generator.py", "editable_output2.txt"], check=True)
|
| 60 |
with open("output3.txt", "r", encoding="utf-8") as f:
|
| 61 |
final_article_content = f.read()
|
| 62 |
except Exception as e:
|
| 63 |
final_article_content = f"予期せぬエラーが発生しました:{str(e)}"
|
| 64 |
print(f"予期せぬエラーが発生しました:{str(e)}")
|
| 65 |
-
return response_text, final_article_content
|
| 66 |
|
| 67 |
with gr.Blocks() as demo:
|
| 68 |
gr.Markdown("### BabyWriterPRO")
|
|
|
|
| 51 |
return response_text, None # 編集可能な記事構成にのみ出力
|
| 52 |
|
| 53 |
elif action == "本文作成":
|
| 54 |
+
response_text = edited_article_structure
|
| 55 |
try:
|
| 56 |
+
final_article_content = generate_article(edited_article_structure)
|
|
|
|
|
|
|
|
|
|
| 57 |
with open("output3.txt", "r", encoding="utf-8") as f:
|
| 58 |
final_article_content = f.read()
|
| 59 |
except Exception as e:
|
| 60 |
final_article_content = f"予期せぬエラーが発生しました:{str(e)}"
|
| 61 |
print(f"予期せぬエラーが発生しました:{str(e)}")
|
| 62 |
+
return response_text, final_article_content
|
| 63 |
|
| 64 |
with gr.Blocks() as demo:
|
| 65 |
gr.Markdown("### BabyWriterPRO")
|