jskinner215 commited on
Commit
f790556
·
1 Parent(s): a17d0ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -177,17 +177,22 @@ if selected_class != "New Class":
177
  st.table(schema_df[["name", "dataType"]]) # Display only the name and dataType columns
178
 
179
  # Before ingesting data into Weaviate, check if CSV columns match the class schema
180
- if csv_file is not None and class_schema: # Ensure class_schema is not None
181
  data = csv_file.read().decode("utf-8")
182
  dataframe = pd.read_csv(StringIO(data))
183
 
 
 
 
 
184
  # Check if columns match
185
- schema_columns = [prop["name"] for prop in class_schema["properties"]]
186
- if set(dataframe.columns) != set(schema_columns):
187
- st.error("The columns in the uploaded CSV do not match the schema of the selected class. Please check and upload the correct CSV.")
188
- else:
189
- # Ingest data into Weaviate
190
- ingest_data_to_weaviate(dataframe, class_name, class_description)
 
191
 
192
  # Input for questions
193
  questions = st.text_area("Enter your questions (one per line)")
 
177
  st.table(schema_df[["name", "dataType"]]) # Display only the name and dataType columns
178
 
179
  # Before ingesting data into Weaviate, check if CSV columns match the class schema
180
+ if csv_file is not None:
181
  data = csv_file.read().decode("utf-8")
182
  dataframe = pd.read_csv(StringIO(data))
183
 
184
+ # Display the uploaded CSV data
185
+ st.write("Uploaded CSV Data:")
186
+ st.write(dataframe)
187
+
188
  # Check if columns match
189
+ if class_schema: # Ensure class_schema is not None
190
+ schema_columns = [prop["name"] for prop in class_schema["properties"]]
191
+ if set(dataframe.columns) != set(schema_columns):
192
+ st.error("The columns in the uploaded CSV do not match the schema of the selected class. Please check and upload the correct CSV or create a new class.")
193
+ else:
194
+ # Ingest data into Weaviate
195
+ ingest_data_to_weaviate(dataframe, class_name, class_description)
196
 
197
  # Input for questions
198
  questions = st.text_area("Enter your questions (one per line)")