Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -28,11 +28,16 @@ with st.sidebar:
|
|
28 |
# Fetch collection names for dropdown
|
29 |
try:
|
30 |
existing_collections = db.list_collection_names()
|
|
|
31 |
selected_collection = st.selectbox("Choose MongoDB Collection", existing_collections, index=existing_collections.index("doc_chunks_cat") if "doc_chunks_cat" in existing_collections else 0)
|
32 |
except Exception as e:
|
33 |
st.error(f"Failed to list collections: {e}")
|
34 |
selected_collection = "doc_chunks_cat"
|
35 |
-
|
|
|
|
|
|
|
|
|
36 |
is_grant_app = st.toggle("Is this a Grant Application?", value=True)
|
37 |
|
38 |
# uploaded_file = st.file_uploader("Upload a DOCX or TXT file", type=["docx", "txt"])
|
|
|
28 |
# Fetch collection names for dropdown
|
29 |
try:
|
30 |
existing_collections = db.list_collection_names()
|
31 |
+
existing_collections.append("Create New Collection")
|
32 |
selected_collection = st.selectbox("Choose MongoDB Collection", existing_collections, index=existing_collections.index("doc_chunks_cat") if "doc_chunks_cat" in existing_collections else 0)
|
33 |
except Exception as e:
|
34 |
st.error(f"Failed to list collections: {e}")
|
35 |
selected_collection = "doc_chunks_cat"
|
36 |
+
if selected_collection == "Create New Collection":
|
37 |
+
selected_collection = st.sidebar.text_input("Enter Collection Name:)")
|
38 |
+
if not selected_collection:
|
39 |
+
st.warning("⚠️ Enter a collection name to proceed.")
|
40 |
+
st.stop()
|
41 |
is_grant_app = st.toggle("Is this a Grant Application?", value=True)
|
42 |
|
43 |
# uploaded_file = st.file_uploader("Upload a DOCX or TXT file", type=["docx", "txt"])
|