Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
882 |
-
|
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 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
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 |
|