Spaces:
Runtime error
Runtime error
minor
Browse files
app.py
CHANGED
|
@@ -177,8 +177,6 @@ def start_haystack():
|
|
| 177 |
|
| 178 |
return pipe
|
| 179 |
|
| 180 |
-
pipe = start_haystack()
|
| 181 |
-
|
| 182 |
@st.cache_resource
|
| 183 |
def check_statement(statement: str, retriever_top_k: int = 5):
|
| 184 |
"""Run query and verify statement"""
|
|
@@ -245,6 +243,8 @@ def main():
|
|
| 245 |
run_pressed or statement != st.session_state.statement
|
| 246 |
)
|
| 247 |
|
|
|
|
|
|
|
| 248 |
# Get results for query
|
| 249 |
if run_query and statement:
|
| 250 |
time_start = time.time()
|
|
@@ -252,7 +252,7 @@ def main():
|
|
| 252 |
st.session_state.statement = statement
|
| 253 |
with st.spinner(" Procurando a Similaridade no banco de sentenças..."):
|
| 254 |
try:
|
| 255 |
-
st.session_state.results = check_statement(statement, RETRIEVER_TOP_K)
|
| 256 |
print(f"S: {statement}")
|
| 257 |
time_end = time.time()
|
| 258 |
print(time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime()))
|
|
|
|
| 177 |
|
| 178 |
return pipe
|
| 179 |
|
|
|
|
|
|
|
| 180 |
@st.cache_resource
|
| 181 |
def check_statement(statement: str, retriever_top_k: int = 5):
|
| 182 |
"""Run query and verify statement"""
|
|
|
|
| 243 |
run_pressed or statement != st.session_state.statement
|
| 244 |
)
|
| 245 |
|
| 246 |
+
pipe = start_haystack()
|
| 247 |
+
|
| 248 |
# Get results for query
|
| 249 |
if run_query and statement:
|
| 250 |
time_start = time.time()
|
|
|
|
| 252 |
st.session_state.statement = statement
|
| 253 |
with st.spinner(" Procurando a Similaridade no banco de sentenças..."):
|
| 254 |
try:
|
| 255 |
+
st.session_state.results = check_statement(pipe, statement, RETRIEVER_TOP_K)
|
| 256 |
print(f"S: {statement}")
|
| 257 |
time_end = time.time()
|
| 258 |
print(time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime()))
|