Martin1998/question_answering
1
1import streamlit as st2import re3 4from transformers import pipeline5 6 7 8st.title("Question - Answering AI App")9st.write("---")10st.write("### Give Content to the AI and quiz it based on the content.")11st.warning("**Powered by AI Language Models...**")12 13st.write("---")14 15content = st.text_area("Paste your content here...", height=200)16 17words = len(re.findall(r'\w+', content))18st.write("**Number of words in Content is :**", words)19 20text = st.text_area("Ask Question here...")21 22 23st.write("---")24 25if st.button("Generate Answer"):26 27 if words == 0:28 29 st.write("### Please! Paste Content into input bar.")30 31 else:32 33 qa = pipeline("question-answering")34 35 response = qa(36 question = text,37 38 context= content39 )40 41 st.info(response['answer'])42 43st.write("---")44 45st.write("### How was the response???")