WebashalarForML commited on
Commit
2f5c10c
·
verified ·
1 Parent(s): c74ee6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -47,8 +47,8 @@ from langchain_groq import ChatGroq
47
  llm = ChatGroq(model="llama3-70b-8192")
48
 
49
  # Connect to the provided database URI using SQLDatabase (which expects a URI)
50
- from langchain_community.utilities import SQLDatabase
51
- db = SQLDatabase.from_uri(DATABASE_URI)
52
 
53
  # Create SQL toolkit and get the tools
54
  from langchain_community.agent_toolkits import SQLDatabaseToolkit
@@ -127,6 +127,8 @@ def create_agent_app(db_path: str):
127
  # Construct the SQLite URI from the given file path.
128
  # Ensure the db_path is absolute so that SQLAlchemy can locate the file.
129
  abs_db_path = os.path.abspath(db_path)
 
 
130
  db_uri = f"sqlite:///{abs_db_path}"
131
 
132
  # Create new SQLDatabase connection using the constructed URI.
@@ -227,8 +229,8 @@ def create_app():
227
  os.makedirs(UPLOAD_FOLDER)
228
 
229
  # Create a global agent_app using the default DATABASE_URI
230
- global agent_app
231
- agent_app = create_agent_app(DATABASE_URI)
232
 
233
  @flask_app.route("/")
234
  def index():
 
47
  llm = ChatGroq(model="llama3-70b-8192")
48
 
49
  # Connect to the provided database URI using SQLDatabase (which expects a URI)
50
+ #from langchain_community.utilities import SQLDatabase
51
+ #db = SQLDatabase.from_uri(DATABASE_URI)
52
 
53
  # Create SQL toolkit and get the tools
54
  from langchain_community.agent_toolkits import SQLDatabaseToolkit
 
127
  # Construct the SQLite URI from the given file path.
128
  # Ensure the db_path is absolute so that SQLAlchemy can locate the file.
129
  abs_db_path = os.path.abspath(db_path)
130
+ DATABASE_URI = abs_db_path
131
+ global DATABASE_URI
132
  db_uri = f"sqlite:///{abs_db_path}"
133
 
134
  # Create new SQLDatabase connection using the constructed URI.
 
229
  os.makedirs(UPLOAD_FOLDER)
230
 
231
  # Create a global agent_app using the default DATABASE_URI
232
+ #global agent_app
233
+ #agent_app = create_agent_app(DATABASE_URI)
234
 
235
  @flask_app.route("/")
236
  def index():