Update app.py
Browse files
app.py
CHANGED
@@ -37,8 +37,8 @@ if pdf_file and question:
|
|
37 |
# Run the pipeline
|
38 |
with st.spinner("Searching for the answer..."):
|
39 |
result = qa_pipeline(img, question)
|
40 |
-
if
|
41 |
-
top_answer =
|
42 |
st.success(f"**Answer:** {top_answer['answer']} (score: {top_answer['score']:.2f})")
|
43 |
else:
|
44 |
st.warning("No answer found.")
|
|
|
37 |
# Run the pipeline
|
38 |
with st.spinner("Searching for the answer..."):
|
39 |
result = qa_pipeline(img, question)
|
40 |
+
if result:
|
41 |
+
top_answer = result[0] # get the highest-scoring answer
|
42 |
st.success(f"**Answer:** {top_answer['answer']} (score: {top_answer['score']:.2f})")
|
43 |
else:
|
44 |
st.warning("No answer found.")
|