jskinner215 commited on
Commit
168f49e
·
1 Parent(s): 13778dd

Update ui_utils.py

Browse files
Files changed (1) hide show
  1. ui_utils.py +15 -0
ui_utils.py CHANGED
@@ -1,5 +1,6 @@
1
  import streamlit as st
2
  import weaviate_utils
 
3
 
4
  def display_initial_buttons():
5
  if "upload_flow" not in st.session_state:
@@ -48,3 +49,17 @@ def display_query_input():
48
  # Call function to query TAPAS with selected data and entered question
49
  # (This function needs to be implemented)
50
  query_tapas_with_weaviate_data(st.session_state.data_source, question)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  import weaviate_utils
3
+ import tapas_utils
4
 
5
  def display_initial_buttons():
6
  if "upload_flow" not in st.session_state:
 
49
  # Call function to query TAPAS with selected data and entered question
50
  # (This function needs to be implemented)
51
  query_tapas_with_weaviate_data(st.session_state.data_source, question)
52
+
53
+ def query_tapas_with_weaviate_data(client, selected_class, question, tokenizer, model):
54
+ # 1. Perform hybrid search
55
+ data = weaviate_utils.hybrid_search_weaviate(client, selected_class, question)
56
+
57
+ # 2. Convert the data to TAPAS format
58
+ table = weaviate_utils.convert_to_tapas_format(data)
59
+
60
+ # 3. Call TAPAS with the table and the question
61
+ answers = tapas_utils.ask_llm_chunk(tokenizer, model, table, [question])
62
+
63
+ # Display the answers
64
+ for answer in answers:
65
+ st.write(f"Answer: {answer}")