File size: 796 Bytes
1068021
0bf21b8
 
1068021
0bf21b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
import torch
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline


# Load the question answering pipeline
question_answerer = pipeline("question-answering", model="finetuning_squad/checkpoint-16000")

# Streamlit app
st.title("Question Answering App")

# Text box for context
context = st.text_area("Enter Context", "")

# Text box for question
question = st.text_input("Enter Question", "")

# Button to find the answer
if st.button("Find Answer"):
    if context and question:
        # Perform question answering
        answer = question_answerer(context=context, question=question)

        # Display the answer
        st.subheader("Answer:")
        st.write(answer)
    else:
        st.warning("Please enter both context and question.")