Ashendilantha commited on
Commit
d21afd0
·
verified ·
1 Parent(s): 090583a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -76,18 +76,21 @@ def chatbot_response(history, user_input, source):
76
  # Always use the user input as a question for the QA pipeline
77
  user_input = user_input.lower() # Optionally make it lowercase
78
 
79
- # Get the context (single article or bulk context)
80
  context = context_storage["context"] if source == "Single Article" else context_storage["bulk_context"]
81
 
82
- # Ensure there's context to query
83
  if context:
84
  with st.spinner("Finding answer..."):
 
85
  result = qa_pipeline(question=user_input, context=context)
86
  answer = result["answer"]
 
 
87
  history.append([user_input, answer])
88
 
89
  return history, ""
90
 
 
91
  # Streamlit App Layout
92
  st.set_page_config(page_title="News Classifier", page_icon="📰")
93
  cover_image = Image.open("cover.png") # Ensure this image exists
 
76
  # Always use the user input as a question for the QA pipeline
77
  user_input = user_input.lower() # Optionally make it lowercase
78
 
79
+ # Get the context from the source (single article or bulk content)
80
  context = context_storage["context"] if source == "Single Article" else context_storage["bulk_context"]
81
 
 
82
  if context:
83
  with st.spinner("Finding answer..."):
84
+ # Pass the user's question and the content from the source (context) to the QA pipeline
85
  result = qa_pipeline(question=user_input, context=context)
86
  answer = result["answer"]
87
+
88
+ # Append the question and answer to the chat history
89
  history.append([user_input, answer])
90
 
91
  return history, ""
92
 
93
+
94
  # Streamlit App Layout
95
  st.set_page_config(page_title="News Classifier", page_icon="📰")
96
  cover_image = Image.open("cover.png") # Ensure this image exists