File size: 676 Bytes
2511bf8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
from transformers import pipeline


st.write("""

# Question Answering System - Squad_V2

A simple QA system that answers questions from the given context. 

Ask me a question and I'll try to answer it.

There are lots of room for imporvements. This is just an initial version.

""")

que = st.text_input("Ask me a question", '')
content = st.text_area("Enter Context", '')

if que != "":
    model_name = "Vasanth/bert-base-uncased-qa-squad2"
    question_answerer = pipeline("question-answering", model=model_name, tokenizer=model_name)
    answer = question_answerer(
    question= que,
    context= content
    )
    st.write(answer["answer"])