Spaces:
Sleeping
Sleeping
old versions
Browse files- .gitignore +3 -0
- app.py +14 -13
- requirements.txt +0 -7
.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
*.wal
|
2 |
+
*.ipynb_checkpoints
|
3 |
+
venv/
|
app.py
CHANGED
@@ -4,7 +4,7 @@ from langchain.llms.openai import OpenAI
|
|
4 |
from langchain.agents import create_sql_agent
|
5 |
from langchain.sql_database import SQLDatabase
|
6 |
from langchain.agents.agent_types import AgentType
|
7 |
-
from
|
8 |
from langchain.agents.agent_toolkits import SQLDatabaseToolkit
|
9 |
from sqlalchemy import create_engine
|
10 |
import sqlite3
|
@@ -15,21 +15,22 @@ st.set_page_config(page_title="Protected Areas Database Chat", page_icon="🦜")
|
|
15 |
st.title("🦜 Protected Areas Database Chat")
|
16 |
|
17 |
db_uri = "duckdb:///:memory:"
|
|
|
18 |
engine = create_engine(db_uri)
|
19 |
from sqlalchemy import text
|
20 |
con = engine.connect()
|
21 |
-
con.execute(text("create or replace view agency_name as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-agency-name.parquet'"))
|
22 |
-
con.execute(text("create or replace view agency_name as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-agency-name.parquet'"))
|
23 |
-
con.execute(text("create or replace view agency_type as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-agency-type.parquet'"))
|
24 |
-
con.execute(text("create or replace view category as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-category.parquet'"))
|
25 |
-
con.execute(text("create or replace view designation_type as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-desgination-type.parquet'"))
|
26 |
-
con.execute(text("create or replace view easement as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-easement.parquet'"))
|
27 |
-
con.execute(text("create or replace view fee as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-fee.parquet'"))
|
28 |
-
con.execute(text("create or replace view marine as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-marine.parquet'"))
|
29 |
-
con.execute(text("create or replace view iucn as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-iucn.parquet'"))
|
30 |
-
con.execute(text("create or replace view public_access as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-public-access.parquet'"))
|
31 |
-
con.execute(text("create or replace view state_name as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-state-name.parquet'"))
|
32 |
-
con.execute(text("create or replace view combined as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-combined.parquet'"))
|
33 |
|
34 |
db = SQLDatabase(engine, view_support=True)
|
35 |
db.get_usable_table_names()
|
|
|
4 |
from langchain.agents import create_sql_agent
|
5 |
from langchain.sql_database import SQLDatabase
|
6 |
from langchain.agents.agent_types import AgentType
|
7 |
+
from langchain_community.callbacks import StreamlitCallbackHandler
|
8 |
from langchain.agents.agent_toolkits import SQLDatabaseToolkit
|
9 |
from sqlalchemy import create_engine
|
10 |
import sqlite3
|
|
|
15 |
st.title("🦜 Protected Areas Database Chat")
|
16 |
|
17 |
db_uri = "duckdb:///:memory:"
|
18 |
+
db_uri = "duckdb:///pad.duckdb"
|
19 |
engine = create_engine(db_uri)
|
20 |
from sqlalchemy import text
|
21 |
con = engine.connect()
|
22 |
+
#con.execute(text("create or replace view agency_name as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-agency-name.parquet'"))
|
23 |
+
#con.execute(text("create or replace view agency_name as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-agency-name.parquet'"))
|
24 |
+
#con.execute(text("create or replace view agency_type as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-agency-type.parquet'"))
|
25 |
+
#con.execute(text("create or replace view category as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-category.parquet'"))
|
26 |
+
#con.execute(text("create or replace view designation_type as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-desgination-type.parquet'"))
|
27 |
+
#con.execute(text("create or replace view easement as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-easement.parquet'"))
|
28 |
+
#con.execute(text("create or replace view fee as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-fee.parquet'"))
|
29 |
+
#con.execute(text("create or replace view marine as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-marine.parquet'"))
|
30 |
+
#con.execute(text("create or replace view iucn as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-iucn.parquet'"))
|
31 |
+
#con.execute(text("create or replace view public_access as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-public-access.parquet'"))
|
32 |
+
#con.execute(text("create or replace view state_name as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-state-name.parquet'"))
|
33 |
+
#con.execute(text("create or replace view combined as select * from 'https://huggingface.co/datasets/boettiger-lab/pad-us-3/resolve/main/parquet/pad-combined.parquet'"))
|
34 |
|
35 |
db = SQLDatabase(engine, view_support=True)
|
36 |
db.get_usable_table_names()
|
requirements.txt
CHANGED
@@ -1,11 +1,4 @@
|
|
1 |
-
pandas
|
2 |
-
pydeck
|
3 |
-
pmtiles
|
4 |
streamlit
|
5 |
-
leafmap
|
6 |
-
ibis-framework[duckdb]
|
7 |
-
altair
|
8 |
-
openai
|
9 |
langchain
|
10 |
langchain-openai
|
11 |
langchain-community
|
|
|
|
|
|
|
|
|
1 |
streamlit
|
|
|
|
|
|
|
|
|
2 |
langchain
|
3 |
langchain-openai
|
4 |
langchain-community
|