Samka1u commited on
Commit
f510144
·
verified ·
1 Parent(s): 1451720

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -148,6 +148,7 @@ def table_description():
148
  Returns:
149
  table_description (String): The table's column names and their data types.
150
  """
 
151
  try:
152
  columns_info = [(col["name"], col["type"]) for col in inspector.get_columns(PATHS.TABLE_NAME)]
153
  table_description = "Columns:\n" + "\n".join([f" - {name}: {col_type}" for name, col_type in columns_info])
@@ -163,6 +164,7 @@ def table_check()-> str:
163
  Returns:
164
  (String): A message containing table status.
165
  """
 
166
  try:
167
  if inspector.has_table(PATHS.TABLE_NAME):
168
  return f"Table '{PATHS.TABLE_NAME}' exists."
@@ -317,8 +319,7 @@ with gr.Blocks() as demo:
317
  gr.ChatInterface(fn=run_prompt, type="messages", chatbot=chatbot)
318
 
319
  if __name__ == "__main__":
320
- inspector = inspect(engine)
321
- # initialize agent once
322
  agent = agent_setup()
323
 
324
  demo.launch(debug=True)
 
148
  Returns:
149
  table_description (String): The table's column names and their data types.
150
  """
151
+ inspector = inspect(engine)
152
  try:
153
  columns_info = [(col["name"], col["type"]) for col in inspector.get_columns(PATHS.TABLE_NAME)]
154
  table_description = "Columns:\n" + "\n".join([f" - {name}: {col_type}" for name, col_type in columns_info])
 
164
  Returns:
165
  (String): A message containing table status.
166
  """
167
+ inspector = inspect(engine)
168
  try:
169
  if inspector.has_table(PATHS.TABLE_NAME):
170
  return f"Table '{PATHS.TABLE_NAME}' exists."
 
319
  gr.ChatInterface(fn=run_prompt, type="messages", chatbot=chatbot)
320
 
321
  if __name__ == "__main__":
322
+ # initialize agent
 
323
  agent = agent_setup()
324
 
325
  demo.launch(debug=True)