Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -60,8 +60,8 @@ current_time = datetime.datetime.now()
|
|
| 60 |
one_day_ago = current_time - datetime.timedelta(days=1)
|
| 61 |
db.remove(Query().timestamp.test(lambda x: datetime.datetime.fromisoformat(x) <= one_day_ago))
|
| 62 |
|
| 63 |
-
st.title("
|
| 64 |
-
st.write("こ
|
| 65 |
|
| 66 |
new_keyword = st.text_input("キーワード:")
|
| 67 |
keyword_id = re.sub(r"\W+", "", new_keyword) if new_keyword else None
|
|
@@ -100,9 +100,9 @@ if keyword_id:
|
|
| 100 |
else:
|
| 101 |
editable_output2 = ""
|
| 102 |
|
| 103 |
-
if st.button("
|
| 104 |
try:
|
| 105 |
-
with st.spinner("
|
| 106 |
urls, keyword = get_top_urls_and_keyword(new_keyword)
|
| 107 |
url1, url2, url3 = urls
|
| 108 |
|
|
@@ -124,7 +124,7 @@ if keyword_id:
|
|
| 124 |
db.upsert({"name": "output1.txt", "content": content, "keyword_id": keyword_id},
|
| 125 |
(Query().name == "output1.txt") & (Query().keyword_id == keyword_id))
|
| 126 |
|
| 127 |
-
with st.spinner("
|
| 128 |
process = subprocess.Popen(["python3", "second.py", keyword])
|
| 129 |
process.wait()
|
| 130 |
|
|
@@ -153,9 +153,9 @@ if keyword_id:
|
|
| 153 |
|
| 154 |
editable_output2 = st.text_area("output2.txtを編集してください:", value=editable_output2)
|
| 155 |
|
| 156 |
-
if st.button("
|
| 157 |
try:
|
| 158 |
-
with st.spinner("
|
| 159 |
subprocess.run(["python3", "run_third.py", editable_output2, keyword_id], check=True)
|
| 160 |
|
| 161 |
with open("output3.txt", "r", encoding="utf-8") as f:
|
|
|
|
| 60 |
one_day_ago = current_time - datetime.timedelta(days=1)
|
| 61 |
db.remove(Query().timestamp.test(lambda x: datetime.datetime.fromisoformat(x) <= one_day_ago))
|
| 62 |
|
| 63 |
+
st.title("Baby Writter")
|
| 64 |
+
st.write("こちらは、与えられたキーワードを使用して生成します。")
|
| 65 |
|
| 66 |
new_keyword = st.text_input("キーワード:")
|
| 67 |
keyword_id = re.sub(r"\W+", "", new_keyword) if new_keyword else None
|
|
|
|
| 100 |
else:
|
| 101 |
editable_output2 = ""
|
| 102 |
|
| 103 |
+
if st.button("構成作成", key=f"run_button_{keyword_id}"):
|
| 104 |
try:
|
| 105 |
+
with st.spinner("キーワード、主題抽出中..."):
|
| 106 |
urls, keyword = get_top_urls_and_keyword(new_keyword)
|
| 107 |
url1, url2, url3 = urls
|
| 108 |
|
|
|
|
| 124 |
db.upsert({"name": "output1.txt", "content": content, "keyword_id": keyword_id},
|
| 125 |
(Query().name == "output1.txt") & (Query().keyword_id == keyword_id))
|
| 126 |
|
| 127 |
+
with st.spinner("タイトル、見出し作成中..."):
|
| 128 |
process = subprocess.Popen(["python3", "second.py", keyword])
|
| 129 |
process.wait()
|
| 130 |
|
|
|
|
| 153 |
|
| 154 |
editable_output2 = st.text_area("output2.txtを編集してください:", value=editable_output2)
|
| 155 |
|
| 156 |
+
if st.button("本文作成"):
|
| 157 |
try:
|
| 158 |
+
with st.spinner("本文作成中..."):
|
| 159 |
subprocess.run(["python3", "run_third.py", editable_output2, keyword_id], check=True)
|
| 160 |
|
| 161 |
with open("output3.txt", "r", encoding="utf-8") as f:
|