Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -121,6 +121,7 @@ def create_agent_app(db_path: str):
|
|
121 |
global DATABASE_URI
|
122 |
DATABASE_URI = abs_db_path
|
123 |
db_uri = f"sqlite:///{abs_db_path}"
|
|
|
124 |
|
125 |
# Create new SQLDatabase connection using the constructed URI.
|
126 |
from langchain_community.utilities import SQLDatabase
|
@@ -263,10 +264,12 @@ def create_app():
|
|
263 |
if request.method == 'POST':
|
264 |
file = request.files.get('file')
|
265 |
if not file:
|
|
|
266 |
return "No file uploaded", 400
|
267 |
if file and file.filename.endswith('.db'):
|
268 |
# Use flask_app.config instead of app.config
|
269 |
db_path = os.path.join(flask_app.config['UPLOAD_FOLDER'], 'uploaded.db')
|
|
|
270 |
file.save(db_path)
|
271 |
|
272 |
# Convert the file path to an absolute path and reinitialize the agent_app
|
|
|
121 |
global DATABASE_URI
|
122 |
DATABASE_URI = abs_db_path
|
123 |
db_uri = f"sqlite:///{abs_db_path}"
|
124 |
+
print("db_uri",db_uri)
|
125 |
|
126 |
# Create new SQLDatabase connection using the constructed URI.
|
127 |
from langchain_community.utilities import SQLDatabase
|
|
|
264 |
if request.method == 'POST':
|
265 |
file = request.files.get('file')
|
266 |
if not file:
|
267 |
+
print("No file uploaded")
|
268 |
return "No file uploaded", 400
|
269 |
if file and file.filename.endswith('.db'):
|
270 |
# Use flask_app.config instead of app.config
|
271 |
db_path = os.path.join(flask_app.config['UPLOAD_FOLDER'], 'uploaded.db')
|
272 |
+
print("file uploaded")
|
273 |
file.save(db_path)
|
274 |
|
275 |
# Convert the file path to an absolute path and reinitialize the agent_app
|