Spaces:
Build error
Build error
Commit
·
dffd9dd
1
Parent(s):
99b5e21
Update ui_utils.py
Browse files- ui_utils.py +10 -6
ui_utils.py
CHANGED
@@ -37,12 +37,16 @@ def handle_new_class_selection(client, selected_class):
|
|
37 |
|
38 |
def csv_upload_and_ingestion(client, selected_class):
|
39 |
csv_file = st.file_uploader("Upload a CSV file", type=["csv"], key="csv_uploader")
|
40 |
-
if csv_file
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
46 |
|
47 |
def display_query_input(client, selected_class, tokenizer, model): # Added parameters
|
48 |
question = st.text_input("Enter your question:", key="query_input")
|
|
|
37 |
|
38 |
def csv_upload_and_ingestion(client, selected_class):
|
39 |
csv_file = st.file_uploader("Upload a CSV file", type=["csv"], key="csv_uploader")
|
40 |
+
if csv_file:
|
41 |
+
if st.button("Confirm CSV upload"):
|
42 |
+
# Call function to ingest CSV data into Weaviate
|
43 |
+
dataframe = weaviate_utils.ingest_data_to_weaviate(client, csv_file, selected_class) # Updated this line
|
44 |
+
if dataframe is not None: # Check if ingestion was successful
|
45 |
+
# Display a preview of the ingested data
|
46 |
+
st.write(f"Your CSV was successfully integrated into the vector database under the class '{selected_class}'")
|
47 |
+
st.write(dataframe.head()) # Display the first few rows of the dataframe as a preview
|
48 |
+
st.session_state.csv_uploaded = True # Set session state variable
|
49 |
+
|
50 |
|
51 |
def display_query_input(client, selected_class, tokenizer, model): # Added parameters
|
52 |
question = st.text_input("Enter your question:", key="query_input")
|