File size: 747 Bytes
372ccf5
 
 
 
 
 
 
b13443d
 
372ccf5
 
7445d77
372ccf5
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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("Passage", 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)