Spaces:
Sleeping
Sleeping
Srikumar26
commited on
Commit
•
f8d9783
1
Parent(s):
03769da
testing-patch
Browse files- fiboa/query.py +4 -3
fiboa/query.py
CHANGED
@@ -8,7 +8,7 @@ from ibis import _
|
|
8 |
|
9 |
def execute_prompt(con, chain, prompt):
|
10 |
response = chain.invoke({"question": prompt})
|
11 |
-
st.write(response)
|
12 |
gdf = as_geopandas(con, response)
|
13 |
|
14 |
if len(gdf) == 0:
|
@@ -28,7 +28,8 @@ def execute_prompt(con, chain, prompt):
|
|
28 |
})
|
29 |
|
30 |
def as_geopandas(con, response):
|
31 |
-
|
|
|
32 |
sql_query = f"CREATE OR REPLACE VIEW testing AS ({response})"
|
33 |
con.raw_sql(sql_query)
|
34 |
gdf = con.table("testing")
|
@@ -47,4 +48,4 @@ def as_geopandas(con, response):
|
|
47 |
if dtype.startswith("datetime64"):
|
48 |
gdf[col] = gdf[col].astype(str)
|
49 |
|
50 |
-
return gdf
|
|
|
8 |
|
9 |
def execute_prompt(con, chain, prompt):
|
10 |
response = chain.invoke({"question": prompt})
|
11 |
+
st.write(response.replace("testing", "crops"))
|
12 |
gdf = as_geopandas(con, response)
|
13 |
|
14 |
if len(gdf) == 0:
|
|
|
28 |
})
|
29 |
|
30 |
def as_geopandas(con, response):
|
31 |
+
#import code; code.interact(local=locals())
|
32 |
+
response = re.sub(";$", "", response).replace("testing", "crops")
|
33 |
sql_query = f"CREATE OR REPLACE VIEW testing AS ({response})"
|
34 |
con.raw_sql(sql_query)
|
35 |
gdf = con.table("testing")
|
|
|
48 |
if dtype.startswith("datetime64"):
|
49 |
gdf[col] = gdf[col].astype(str)
|
50 |
|
51 |
+
return gdf
|