Quazim0t0 commited on
Commit
207d5a0
·
verified ·
1 Parent(s): a3dd4d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import os
2
  import gradio as gr
3
- from sqlalchemy import text, create_engine, inspect
4
  from smolagents import tool, CodeAgent, HfApiModel
5
  import pandas as pd
6
  import tempfile
@@ -80,17 +80,17 @@ def get_table_data(table_name):
80
  except Exception as e:
81
  return pd.DataFrame({"Error": [str(e)]})
82
 
83
- # SQL Execution Tool
84
  @tool
85
  def sql_engine(query: str) -> str:
86
  """
87
  Executes an SQL SELECT query and returns the results.
88
 
89
  Args:
90
- query (str): The SQL query to execute.
91
 
92
  Returns:
93
- str: The query results as a formatted string, or an error message.
94
  """
95
  try:
96
  with engine.connect() as con:
 
1
  import os
2
  import gradio as gr
3
+ from sqlalchemy import text, inspect
4
  from smolagents import tool, CodeAgent, HfApiModel
5
  import pandas as pd
6
  import tempfile
 
80
  except Exception as e:
81
  return pd.DataFrame({"Error": [str(e)]})
82
 
83
+ # SQL Execution Tool (FIXED Docstring for `smolagents`)
84
  @tool
85
  def sql_engine(query: str) -> str:
86
  """
87
  Executes an SQL SELECT query and returns the results.
88
 
89
  Args:
90
+ query (str): The SQL query string to execute.
91
 
92
  Returns:
93
+ str: The formatted query results, or an error message if the query fails.
94
  """
95
  try:
96
  with engine.connect() as con: