Spaces:
Sleeping
Sleeping
Commit
·
2f3b295
1
Parent(s):
245d859
resolved path issue
Browse files
lang_assistant/langhelper.py
CHANGED
|
@@ -57,7 +57,8 @@ def chat_with_df(query, table_name = None):
|
|
| 57 |
#get data
|
| 58 |
# con = sqlite3.connect("database.db")
|
| 59 |
# df = pd.read_sql_query(f"SELECT * from {table_name}", con)
|
| 60 |
-
|
|
|
|
| 61 |
|
| 62 |
agent = create_pandas_dataframe_agent(
|
| 63 |
ChatOpenAI(temperature=0, model="gpt-3.5-turbo-0613"),
|
|
@@ -114,9 +115,11 @@ def generate_graphdata(query, table_name = None):
|
|
| 114 |
df = pd.read_csv(r"https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv")
|
| 115 |
else:
|
| 116 |
#get data from sqlite db
|
| 117 |
-
con = sqlite3.connect("database.db")
|
| 118 |
-
df = pd.read_sql_query(f"SELECT * from {table_name}", con)
|
| 119 |
-
|
|
|
|
|
|
|
| 120 |
jsondf = df.head(5).to_json(orient='records')
|
| 121 |
|
| 122 |
prompt_template = ChatPromptTemplate.from_messages(
|
|
|
|
| 57 |
#get data
|
| 58 |
# con = sqlite3.connect("database.db")
|
| 59 |
# df = pd.read_sql_query(f"SELECT * from {table_name}", con)
|
| 60 |
+
filename = f"referencefiles/{table_name}.csv"
|
| 61 |
+
df = pd.read_csv(filename)
|
| 62 |
|
| 63 |
agent = create_pandas_dataframe_agent(
|
| 64 |
ChatOpenAI(temperature=0, model="gpt-3.5-turbo-0613"),
|
|
|
|
| 115 |
df = pd.read_csv(r"https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv")
|
| 116 |
else:
|
| 117 |
#get data from sqlite db
|
| 118 |
+
#con = sqlite3.connect("database.db")
|
| 119 |
+
#df = pd.read_sql_query(f"SELECT * from {table_name}", con)
|
| 120 |
+
filename = f"referencefiles/{table_name}.csv"
|
| 121 |
+
df = pd.read_csv(filename)
|
| 122 |
+
|
| 123 |
jsondf = df.head(5).to_json(orient='records')
|
| 124 |
|
| 125 |
prompt_template = ChatPromptTemplate.from_messages(
|