shripadbhat commited on
Commit
4c700e7
1 Parent(s): d24f707

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -12
app.py CHANGED
@@ -4,17 +4,6 @@ from transformers import pipeline
4
  from sentence_transformers import CrossEncoder
5
  from transformers import AutoTokenizer, AutoModelWithLMHead, pipeline
6
 
7
- model_name = "MaRiOrOsSi/t5-base-finetuned-question-answering"
8
- tokenizer = AutoTokenizer.from_pretrained(model_name)
9
- model = AutoModelWithLMHead.from_pretrained(model_name)
10
-
11
- #from transformers import pipeline
12
-
13
- #text2text_generator = pipeline("text2text-generation", model = "gpt2")
14
-
15
- sentence_segmenter = pysbd.Segmenter(language='en',clean=False)
16
- passage_retreival_model = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2')
17
- qa_model = pipeline("question-answering",'a-ware/bart-squadv2')
18
 
19
  def fetch_answers(question, document ):
20
  document_paragraphs = document.splitlines()
@@ -56,10 +45,22 @@ def fetch_answers(question, document ):
56
 
57
  return top_5_query_paragraph_answer_list
58
 
 
59
  st.title('Document Question Answering System')
60
  query = st.text_area("Query", "", height=25)
61
  document = st.text_area("Document Text", "", height=100)
62
 
 
 
63
  if st.button("Get Answers From Document"):
64
- st.markdown(fetch_answers(query, document))
 
 
 
 
 
 
 
 
 
65
 
 
4
  from sentence_transformers import CrossEncoder
5
  from transformers import AutoTokenizer, AutoModelWithLMHead, pipeline
6
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  def fetch_answers(question, document ):
9
  document_paragraphs = document.splitlines()
 
45
 
46
  return top_5_query_paragraph_answer_list
47
 
48
+
49
  st.title('Document Question Answering System')
50
  query = st.text_area("Query", "", height=25)
51
  document = st.text_area("Document Text", "", height=100)
52
 
53
+
54
+
55
  if st.button("Get Answers From Document"):
56
+
57
+ model_name = "MaRiOrOsSi/t5-base-finetuned-question-answering"
58
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
59
+ model = AutoModelWithLMHead.from_pretrained(model_name)
60
+
61
+ sentence_segmenter = pysbd.Segmenter(language='en',clean=False)
62
+ passage_retreival_model = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2')
63
+ qa_model = pipeline("question-answering",'a-ware/bart-squadv2')
64
+
65
+ st.markdown(fetch_answers(query, document))
66