Spaces:
Sleeping
Sleeping
Commit
•
703b8c7
1
Parent(s):
fc63ff2
Update app.py
Browse files
app.py
CHANGED
@@ -73,7 +73,39 @@ def query_vectara(query: str, case_number: int, filter_str="", lambda_val=0.0) -
|
|
73 |
answer = result["responseSet"][0]["summary"][0]["text"]
|
74 |
return re.sub(r'\[\d+(,\d+){0,5}\]', '', answer)
|
75 |
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
# Streamlit UI
|
78 |
st.title('Vectara Query Interface')
|
79 |
|
@@ -98,7 +130,7 @@ if st.button('Search'):
|
|
98 |
else:
|
99 |
st.error("Please enter a query to search.")
|
100 |
|
101 |
-
|
102 |
|
103 |
# Initialize the HHEM model +++++++++++++++++++++++++++++++++++++++++++++++
|
104 |
model = CrossEncoder('vectara/hallucination_evaluation_model')
|
|
|
73 |
answer = result["responseSet"][0]["summary"][0]["text"]
|
74 |
return re.sub(r'\[\d+(,\d+){0,5}\]', '', answer)
|
75 |
|
76 |
+
|
77 |
+
# Title
|
78 |
+
st.title('Vectara Query Interface')
|
79 |
+
|
80 |
+
# Combine case number selection with query input
|
81 |
+
case_number = st.selectbox("Select Case Number:", range(2001, 2099), format_func=lambda x: f"Case Number = {x}")
|
82 |
+
|
83 |
+
# User input for query
|
84 |
+
user_query = st.text_input("Enter your query:", "")
|
85 |
+
|
86 |
+
# Display case number with query input
|
87 |
+
combined_query = f"{user_query} for {case_number}" if user_query else ""
|
88 |
+
|
89 |
+
# Advanced options
|
90 |
+
st.sidebar.header("Advanced Options")
|
91 |
+
filter_str = st.sidebar.text_input("Filter String:", "")
|
92 |
+
lambda_val = st.sidebar.slider("Lambda Value:", min_value=0.0, max_value=1.0, value=0.025)
|
93 |
+
|
94 |
+
# Search button
|
95 |
+
if st.button('Search'):
|
96 |
+
if combined_query:
|
97 |
+
with st.spinner('Querying Vectara...'):
|
98 |
+
# Assuming `query_vectara` is a function that takes the combined query, filter string, and lambda value
|
99 |
+
output = query_vectara(combined_query, filter_str, lambda_val)
|
100 |
+
st.markdown("## Result")
|
101 |
+
st.write(output)
|
102 |
+
else:
|
103 |
+
st.error("Please enter a query to search.")
|
104 |
+
|
105 |
+
|
106 |
+
|
107 |
+
|
108 |
+
"""
|
109 |
# Streamlit UI
|
110 |
st.title('Vectara Query Interface')
|
111 |
|
|
|
130 |
else:
|
131 |
st.error("Please enter a query to search.")
|
132 |
|
133 |
+
"""
|
134 |
|
135 |
# Initialize the HHEM model +++++++++++++++++++++++++++++++++++++++++++++++
|
136 |
model = CrossEncoder('vectara/hallucination_evaluation_model')
|