jskinner215 commited on
Commit
cc87f36
·
1 Parent(s): 77a6da5

Update ui_utils.py

Browse files
Files changed (1) hide show
  1. ui_utils.py +8 -12
ui_utils.py CHANGED
@@ -70,22 +70,18 @@ def display_query_input(client, selected_class, tokenizer, model): # Added para
70
  st.write(f"Selected class type: {type(selected_class)}, Value: {selected_class}")
71
 
72
 
73
-
74
  def query_tapas_with_weaviate_data(client, selected_class, question, tokenizer, model):
75
- # 1. Perform hybrid search
76
- data = weaviate_utils.hybrid_search_weaviate(client, selected_class, question)
77
- st.write(f"Data from Weaviate: {data}") # Logging data from Weaviate
78
-
79
- # 2. Convert the data to TAPAS format
80
- table = weaviate_utils.convert_to_tapas_format(data)
81
- st.write(f"Data for TAPAS: {table}") # Logging data from TAPAS Table
82
-
83
- # 3. Call TAPAS with the table and the question
84
  answers = tapas_utils.ask_llm_chunk(tokenizer, model, table, [question])
85
- st.write(f"TAPAS answers: {answers}") # Logging data from TAPAS Answers
86
-
87
  # Display the answers
88
  for answer in answers:
89
  st.write(f"Answer: {answer}")
90
 
91
 
 
 
70
  st.write(f"Selected class type: {type(selected_class)}, Value: {selected_class}")
71
 
72
 
 
73
  def query_tapas_with_weaviate_data(client, selected_class, question, tokenizer, model):
74
+ # Embed the question
75
+ question_embedding = tapas_utils.embed_table(pd.DataFrame([question], columns=["Question"]))
76
+ # Retrieve the most relevant table
77
+ table = weaviate_utils.retrieve_relevant_table(client, selected_class, question_embedding)
78
+ # Convert the table to TAPAS format
79
+ table = weaviate_utils.convert_to_tapas_format(table)
80
+ # Call TAPAS with the table and the question
 
 
81
  answers = tapas_utils.ask_llm_chunk(tokenizer, model, table, [question])
 
 
82
  # Display the answers
83
  for answer in answers:
84
  st.write(f"Answer: {answer}")
85
 
86
 
87
+