jskinner215 commited on
Commit
e26e61e
·
1 Parent(s): 382ab41

Update ui_utils.py

Browse files
Files changed (1) hide show
  1. ui_utils.py +8 -10
ui_utils.py CHANGED
@@ -37,16 +37,14 @@ 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
- if st.button("Confirm CSV upload"):
42
- # Call function to ingest CSV data into Weaviate
43
- weaviate_utils.ingest_data_to_weaviate(client, csv_file, selected_class)
44
- # Display a preview of the ingested data
45
- st.write(f"Your CSV was successfully integrated into the vector database under the class '{selected_class}'")
46
- st.write(dataframe.head()) # Display the first few rows of the dataframe as a preview
47
- st.session_state.csv_uploaded = True # Set session state variable
48
-
49
- def display_query_input():
50
  question = st.text_input("Enter your question:", key="query_input")
51
 
52
  # Display the "Submit Query" button if CSV has been uploaded
 
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 and st.button("Confirm CSV upload"):
41
+ dataframe = weaviate_utils.ingest_data_to_weaviate(client, csv_file, selected_class) # Updated this line
42
+ if dataframe is not None: # Check if dataframe is returned
43
+ st.write(f"Your CSV was successfully integrated into the vector database under the class '{selected_class}'")
44
+ st.write(dataframe.head()) # Display the first few rows of the dataframe as a preview
45
+ st.session_state.csv_uploaded = True # Set session state variable
46
+
47
+ def display_query_input(client, selected_class, tokenizer, model): # Added parameters
 
 
48
  question = st.text_input("Enter your question:", key="query_input")
49
 
50
  # Display the "Submit Query" button if CSV has been uploaded