Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -246,14 +246,17 @@ def create_app():
|
|
246 |
|
247 |
@flask_app.route("/upload", methods=["POST"])
|
248 |
def upload():
|
249 |
-
|
250 |
-
if
|
251 |
-
|
252 |
-
|
253 |
-
|
|
|
|
|
|
|
254 |
|
255 |
# Convert the file path to an absolute path and reinitialize the agent_app
|
256 |
-
abs_file_path = os.path.abspath(
|
257 |
global agent_app
|
258 |
agent_app = create_agent_app(abs_file_path)
|
259 |
|
|
|
246 |
|
247 |
@flask_app.route("/upload", methods=["POST"])
|
248 |
def upload():
|
249 |
+
|
250 |
+
if request.method == 'POST':
|
251 |
+
file = request.files['file']
|
252 |
+
if not file:
|
253 |
+
return "No file uploaded", 400
|
254 |
+
if file and file.filename.endswith('.db'):
|
255 |
+
db_path = os.path.join(app.config['UPLOAD_FOLDER'], 'uploaded.db')
|
256 |
+
file.save(db_path)
|
257 |
|
258 |
# Convert the file path to an absolute path and reinitialize the agent_app
|
259 |
+
abs_file_path = os.path.abspath(db_path)
|
260 |
global agent_app
|
261 |
agent_app = create_agent_app(abs_file_path)
|
262 |
|