| import streamlit as st |
| from transformers import pipeline |
|
|
| |
| qa_pipeline = pipeline("question-answering", model = 'bert-large-uncased-whole-word-masking-finetuned-squad') |
|
|
| |
| st.title("Question and Answer System") |
| st.write("Enter a context and ask a question to get an answer.") |
|
|
| |
| context = st.text_area("Context:", "") |
| question = st.text_input("Your question:", "") |
|
|
| |
| if st.button("Get Answer"): |
| if context.strip() and question.strip(): |
| result = qa_pipeline(question=question, context=context) |
| st.write("Answer:") |
| st.write(result['answer']) |
| else: |
| st.write("Please enter both context and a question.") |
|
|