Update app.py
Browse files
app.py
CHANGED
@@ -37,4 +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 |
-
|
|
|
|
|
|
|
|
|
|
37 |
# Run the pipeline
|
38 |
with st.spinner("Searching for the answer..."):
|
39 |
result = qa_pipeline(img, question)
|
40 |
+
if results:
|
41 |
+
top_answer = results[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.")
|