Yasu777 commited on
Commit
00a64ba
·
verified ·
1 Parent(s): 23d94d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
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")