Spaces:
Sleeping
Sleeping
Update fiboa/query.py
Browse files- fiboa/query.py +3 -2
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")
|
|
|
|
| 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")
|