GHarshasri commited on
Commit
0625ae6
·
verified ·
1 Parent(s): 37c88b5

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +3 -3
src/streamlit_app.py CHANGED
@@ -36,7 +36,7 @@ def create_tables():
36
 
37
  # ---------------- FUNCTIONS ----------------
38
  def add_district(name):
39
- conn = sqlite3.connect(DB_PATH)
40
  cursor = conn.cursor()
41
  cursor.execute("INSERT OR IGNORE INTO districts(name) VALUES(?)", (name,))
42
  conn.commit()
@@ -108,14 +108,14 @@ elif menu == "Add Data":
108
  district_name = st.text_input("District Name")
109
  submitted = st.form_submit_button("Add District")
110
  if submitted and district_name:
111
- add_district(district_name)
112
  st.success(f"✅ District '{district_name}' added!")
113
 
114
  st.write("---")
115
 
116
  # Add Category
117
  with st.form("add_category_form"):
118
- conn = sqlite3.connect(DB_PATH)
119
  cursor = conn.cursor()
120
  cursor.execute("SELECT name FROM districts")
121
  district_list = [row[0] for row in cursor.fetchall()]
 
36
 
37
  # ---------------- FUNCTIONS ----------------
38
  def add_district(name):
39
+
40
  cursor = conn.cursor()
41
  cursor.execute("INSERT OR IGNORE INTO districts(name) VALUES(?)", (name,))
42
  conn.commit()
 
108
  district_name = st.text_input("District Name")
109
  submitted = st.form_submit_button("Add District")
110
  if submitted and district_name:
111
+
112
  st.success(f"✅ District '{district_name}' added!")
113
 
114
  st.write("---")
115
 
116
  # Add Category
117
  with st.form("add_category_form"):
118
+
119
  cursor = conn.cursor()
120
  cursor.execute("SELECT name FROM districts")
121
  district_list = [row[0] for row in cursor.fetchall()]