awacke1 commited on
Commit
70a4903
β€’
1 Parent(s): 89e2fcb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -27
app.py CHANGED
@@ -872,23 +872,9 @@ def main():
872
  height=300)
873
 
874
  if st.button("βž• Create New Document"):
875
- #try:
876
- # new_doc = json.loads(new_doc_str)
877
- # new_doc['id'] = new_id # Ensure ID matches input field
878
-
879
-
880
  try:
881
- new_item = {
882
- "id": str(uuid.uuid4()),
883
- "Document": str(uuid.uuid4()),
884
- }
885
-
886
- container.create_item(new_item)
887
- print(f"value loaded with ${new_item} \n")
888
- except Exception:
889
- print(Exception)
890
-
891
-
892
  success, message = insert_record(container, new_doc)
893
  if success:
894
  st.success(f"New document created with id: {new_doc['id']} πŸŽ‰")
@@ -898,17 +884,17 @@ def main():
898
  st.error(message)
899
  except json.JSONDecodeError as e:
900
  st.error(f"Invalid JSON: {str(e)} 🚫")
901
-
902
-
903
- st.subheader(f"πŸ“Š Container: {st.session_state.selected_container}")
904
- if st.session_state.selected_container:
905
- if documents_to_display:
906
- Label = '# πŸ“Š Data display - Data tells tales that words cannot'
907
- st.markdown(Label)
908
- df = pd.DataFrame(documents_to_display)
909
- st.dataframe(df)
910
- else:
911
- st.info("No documents to display. 🧐")
912
 
913
 
914
 
 
872
  height=300)
873
 
874
  if st.button("βž• Create New Document"):
 
 
 
 
 
875
  try:
876
+ new_doc = json.loads(new_doc_str)
877
+ new_doc['id'] = new_id # Ensure ID matches input field
 
 
 
 
 
 
 
 
 
878
  success, message = insert_record(container, new_doc)
879
  if success:
880
  st.success(f"New document created with id: {new_doc['id']} πŸŽ‰")
 
884
  st.error(message)
885
  except json.JSONDecodeError as e:
886
  st.error(f"Invalid JSON: {str(e)} 🚫")
887
+
888
+
889
+ st.subheader(f"πŸ“Š Container: {st.session_state.selected_container}")
890
+ if st.session_state.selected_container:
891
+ if documents_to_display:
892
+ Label = '# πŸ“Š Data display - Data tells tales that words cannot'
893
+ st.markdown(Label)
894
+ df = pd.DataFrame(documents_to_display)
895
+ st.dataframe(df)
896
+ else:
897
+ st.info("No documents to display. 🧐")
898
 
899
 
900