Spaces:
				
			
			
	
			
			
		Build error
		
	
	
	
			
			
	
	
	
	
		
		
		Build error
		
	File size: 797 Bytes
			
			| 8abeb87 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | import streamlit as st
from transformers import pipeline
st.set_page_config(
    page_title="Question Answer",
    page_icon="❓")
# App Name
st.write("# Question Answer")
# Model
qa_model = pipeline("question-answering", model="distilbert/distilbert-base-cased-distilled-squad")
st.write("Provide context and question.")
question = st.text_input("Enter your question:")
context = st.text_input("Enter the context:")
if st.button("Generate Answer"):
    if not (question or context):
        st.warning("Provide both question and context.")
    else:
        try:
            st.write("## Answer")
            ans = qa_model(question=question, context=context)
            st.write(ans['answer'])
        except Exception as e:
            st.error(f"An error occurred: {e}")
             |