QA_Model / app.py
Suhaib-27's picture
Update app.py
b13443d verified
raw
history blame
No virus
747 Bytes
import streamlit as st
from transformers import pipeline
# Load the QA pipeline with the specified model
qa_pipeline = pipeline("question-answering", model="Suhaib-27/my_awesome_qa_model")
# Streamlit app
st.title("Question Answering for Comprehension Passages")
st.write("Enter the passage and the question, and the model will provide the answer.")
# Input fields for context and question
context = st.text_area("Context", height=200)
question = st.text_input("Question")
# If context and question are provided, perform the inference
if context and question:
# Get the answer from the pipeline
result = qa_pipeline(question=question, context=context)
answer = result['answer']
st.write("### Answer")
st.write(answer)