Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -221,9 +221,13 @@ with gr.Blocks() as agent_ui:
|
|
| 221 |
|
| 222 |
code, preview, words, keywords = generate_blogger_html(app_query, custom_link, mod_features, t_color, t_link, c_size)
|
| 223 |
|
| 224 |
-
#
|
| 225 |
-
|
| 226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
# --- BINDS ---
|
| 228 |
login_btn.click(fn=verify_login, inputs=[pwd_input, session_state], outputs=[session_state, login_screen, main_app, login_err])
|
| 229 |
|
|
|
|
| 221 |
|
| 222 |
code, preview, words, keywords = generate_blogger_html(app_query, custom_link, mod_features, t_color, t_link, c_size)
|
| 223 |
|
| 224 |
+
# --- THE FIX: Only attempt to serve the file if it exists and there are no errors ---
|
| 225 |
+
if os.path.exists("latest_draft.txt") and not code.startswith("Error"):
|
| 226 |
+
file_update = gr.update(value="latest_draft.txt", visible=True)
|
| 227 |
+
else:
|
| 228 |
+
file_update = gr.update(value=None, visible=False)
|
| 229 |
+
|
| 230 |
+
return code, preview, words, keywords, gr.update(visible=False), gr.update(visible=True), state, file_update
|
| 231 |
# --- BINDS ---
|
| 232 |
login_btn.click(fn=verify_login, inputs=[pwd_input, session_state], outputs=[session_state, login_screen, main_app, login_err])
|
| 233 |
|