Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -270,13 +270,14 @@ def create_app():
|
|
270 |
db_path = os.path.join(app.config['UPLOAD_FOLDER'], 'uploaded.db')
|
271 |
file.save(db_path)
|
272 |
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
|
278 |
-
|
279 |
-
|
|
|
280 |
|
281 |
return flask_app, socketio
|
282 |
|
|
|
270 |
db_path = os.path.join(app.config['UPLOAD_FOLDER'], 'uploaded.db')
|
271 |
file.save(db_path)
|
272 |
|
273 |
+
# Convert the file path to an absolute path and reinitialize the agent_app
|
274 |
+
abs_file_path = os.path.abspath(db_path)
|
275 |
+
global agent_app
|
276 |
+
agent_app = create_agent_app(abs_file_path)
|
277 |
|
278 |
+
socketio.emit("log", {"message": f"[INFO]: Database file '{file.filename}' uploaded and loaded."})
|
279 |
+
return redirect(url_for("index")) # Go back to index page
|
280 |
+
return render_template("upload.html")
|
281 |
|
282 |
return flask_app, socketio
|
283 |
|