Spaces:
Build error
Build error
Commit
·
d867f48
1
Parent(s):
5a6d9a0
Update ui_utils.py
Browse files- ui_utils.py +13 -4
ui_utils.py
CHANGED
@@ -41,14 +41,23 @@ def csv_upload_and_ingestion(client, selected_class):
|
|
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 |
-
|
|
|
|
|
|
|
|
|
45 |
def display_query_input():
|
46 |
-
question = st.text_input("Enter your question:")
|
|
|
|
|
47 |
if question:
|
48 |
if st.button("Submit Query"):
|
49 |
# Call function to query TAPAS with selected data and entered question
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
52 |
|
53 |
def query_tapas_with_weaviate_data(client, selected_class, question, tokenizer, model):
|
54 |
# 1. Perform hybrid search
|
|
|
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 |
+
# Check if the question input is not empty
|
53 |
if question:
|
54 |
if st.button("Submit Query"):
|
55 |
# Call function to query TAPAS with selected data and entered question
|
56 |
+
query_tapas_with_weaviate_data(client, selected_class, question, tokenizer, model)
|
57 |
+
elif st.session_state.get("csv_uploaded", False): # Check if CSV has been uploaded
|
58 |
+
if st.button("Submit Query"):
|
59 |
+
st.warning("Please provide a text query in the 'Enter your question:' input box to proceed.")
|
60 |
+
|
61 |
|
62 |
def query_tapas_with_weaviate_data(client, selected_class, question, tokenizer, model):
|
63 |
# 1. Perform hybrid search
|