ofermend commited on
Commit
a8f65a9
·
1 Parent(s): 4f8926e
Files changed (3) hide show
  1. .gitignore +2 -1
  2. README.md +0 -1
  3. app.py +6 -3
.gitignore CHANGED
@@ -139,4 +139,5 @@ dmypy.json
139
  # project file
140
  project.yaml
141
 
142
- .idea/
 
 
139
  # project file
140
  project.yaml
141
 
142
+ .idea/
143
+ ev_database.db
README.md CHANGED
@@ -5,7 +5,6 @@ colorFrom: indigo
5
  colorTo: indigo
6
  sdk: docker
7
  app_port: 8501
8
- app_file: app.py
9
  pinned: false
10
  license: apache-2.0
11
  short_description: EV Assistant using vectara-agent
 
5
  colorTo: indigo
6
  sdk: docker
7
  app_port: 8501
 
8
  pinned: false
9
  license: apache-2.0
10
  short_description: EV Assistant using vectara-agent
app.py CHANGED
@@ -1,5 +1,6 @@
1
  from PIL import Image
2
  import sys
 
3
 
4
  import streamlit as st
5
  from streamlit_pills import pills
@@ -156,16 +157,18 @@ def setup_db():
156
  sql_script = sql_file.read()
157
  cursor.executescript(sql_script)
158
 
 
 
159
  # Load data into ev_population table
160
- df = load_dataset("vectara/ev-dataset", data_files="Electric_Vehicle_Population_Data.csv")['train'].to_pandas()
161
  df.to_sql('ev_population', conn, if_exists='replace', index=False)
162
 
163
  # Load data into county_registrations table
164
- df = load_dataset("vectara/ev-dataset", data_files="Electric_Vehicle_Population_Size_History_By_County.csv")['train'].to_pandas()
165
  df.to_sql('county_registrations', conn, if_exists='replace', index=False)
166
 
167
  # Load data into ev_registrations table
168
- df = load_dataset("vectara/ev-dataset", data_files="Electric_Vehicle_Title_and_Registration_Activity.csv")['train'].to_pandas()
169
  df.to_sql('ev_registrations', conn, if_exists='replace', index=False)
170
 
171
  # Commit changes and close connection
 
1
  from PIL import Image
2
  import sys
3
+ import os
4
 
5
  import streamlit as st
6
  from streamlit_pills import pills
 
157
  sql_script = sql_file.read()
158
  cursor.executescript(sql_script)
159
 
160
+ hf_token = os.getenv('HF_TOKEN')
161
+
162
  # Load data into ev_population table
163
+ df = load_dataset("vectara/ev-dataset", data_files="Electric_Vehicle_Population_Data.csv", use_auth_token=hf_token)['train'].to_pandas()
164
  df.to_sql('ev_population', conn, if_exists='replace', index=False)
165
 
166
  # Load data into county_registrations table
167
+ df = load_dataset("vectara/ev-dataset", data_files="Electric_Vehicle_Population_Size_History_By_County.csv", use_auth_token=hf_token)['train'].to_pandas()
168
  df.to_sql('county_registrations', conn, if_exists='replace', index=False)
169
 
170
  # Load data into ev_registrations table
171
+ df = load_dataset("vectara/ev-dataset", data_files="Electric_Vehicle_Title_and_Registration_Activity.csv", use_auth_token=hf_token)['train'].to_pandas()
172
  df.to_sql('ev_registrations', conn, if_exists='replace', index=False)
173
 
174
  # Commit changes and close connection