devve1 commited on
Commit
b7169ce
1 Parent(s): 39636c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -293,7 +293,8 @@ def load_models_and_documents():
293
  )
294
  )
295
 
296
- conn = sqlite3.connect(':memory:', check_same_thread=False)
 
297
  cursor = conn.cursor()
298
 
299
  cursor.execute('''
@@ -529,6 +530,7 @@ if __name__ == '__main__':
529
  print(f'Check : {st.session_state.key_data_editor}')
530
 
531
  if st.session_state.key_data_editor['deleted_rows'] and (st.session_state.key_data_editor['deleted_rows'][-1] in st.session_state.df):
 
532
  print('HELLO')
533
  name = st.session_state.df.loc[st.session_state.key_data_editor['deleted_rows'][-1], 'document']
534
  print(f'{name}')
@@ -540,6 +542,7 @@ if __name__ == '__main__':
540
  points_selector=PointIdsList(points=ids_values)
541
  )
542
  delete_document(conn, cursor, name)
 
543
 
544
 
545
  if menu_id == 'Documents':
 
293
  )
294
  )
295
 
296
+ conn = sqlite3.connect(':memory:', check_same_thread=False)
297
+ conn.execute('PRAGMA foreign_keys = ON;')
298
  cursor = conn.cursor()
299
 
300
  cursor.execute('''
 
530
  print(f'Check : {st.session_state.key_data_editor}')
531
 
532
  if st.session_state.key_data_editor['deleted_rows'] and (st.session_state.key_data_editor['deleted_rows'][-1] in st.session_state.df):
533
+ st.toast('Wait for deletion to complete...')
534
  print('HELLO')
535
  name = st.session_state.df.loc[st.session_state.key_data_editor['deleted_rows'][-1], 'document']
536
  print(f'{name}')
 
542
  points_selector=PointIdsList(points=ids_values)
543
  )
544
  delete_document(conn, cursor, name)
545
+ st.toast('Deletion completed !', icon='🎉')
546
 
547
 
548
  if menu_id == 'Documents':