lone-wolf-beta commited on
Commit
e93043a
·
1 Parent(s): 9e5e6e5
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -1,6 +1,7 @@
1
  # pip install --upgrade pip
2
  # pip install transformers==4.11.3
3
  #pip install git+https://github.com/huggingface/transformers
 
4
  import torch
5
  import streamlit as st
6
  from transformers import BertForQuestionAnswering
@@ -77,13 +78,23 @@ import textwrap
77
 
78
  # Wrap text to 80 characters.
79
  wrapper = textwrap.TextWrapper(width=80)
 
80
 
81
- bert_abstract = "We introduce a new language representation model called BERT, which stands for Bidirectional Encoder Representations from Transformers. Unlike recent language representation models (Peters et al., 2018a; Radford et al., 2018), BERT is designed to pretrain deep bidirectional representations from unlabeled text by jointly conditioning on both left and right context in all layers. As a result, the pre-trained BERT model can be finetuned with just one additional output layer to create state-of-the-art models for a wide range of tasks, such as question answering and language inference, without substantial taskspecific architecture modifications. BERT is conceptually simple and empirically powerful. It obtains new state-of-the-art results on eleven natural language processing tasks, including pushing the GLUE score to 80.5% (7.7% point absolute improvement), MultiNLI accuracy to 86.7% (4.6% absolute improvement), SQuAD v1.1 question answering Test F1 to 93.2 (1.5 point absolute improvement) and SQuAD v2.0 Test F1 to 83.1 (5.1 point absolute improvement)."
82
- wrapper.fill(bert_abstract)
 
83
 
84
  #question = "What does the 'B' in BERT stand for?"
85
  question = st.text_area('Enter your question...')
86
-
87
  answer=answer_question(question, bert_abstract)
 
 
 
 
 
 
 
 
 
 
88
 
89
- st.text(answer)
 
1
  # pip install --upgrade pip
2
  # pip install transformers==4.11.3
3
  #pip install git+https://github.com/huggingface/transformers
4
+
5
  import torch
6
  import streamlit as st
7
  from transformers import BertForQuestionAnswering
 
78
 
79
  # Wrap text to 80 characters.
80
  wrapper = textwrap.TextWrapper(width=80)
81
+ context=st.text_area('Enter the context of your Topic')
82
 
83
+ #bert_abstract = "We introduce a new language representation model called BERT, which stands for Bidirectional Encoder Representations from Transformers. Unlike recent language representation models (Peters et al., 2018a; Radford et al., 2018), BERT is designed to pretrain deep bidirectional representations from unlabeled text by jointly conditioning on both left and right context in all layers. As a result, the pre-trained BERT model can be finetuned with just one additional output layer to create state-of-the-art models for a wide range of tasks, such as question answering and language inference, without substantial taskspecific architecture modifications. BERT is conceptually simple and empirically powerful. It obtains new state-of-the-art results on eleven natural language processing tasks, including pushing the GLUE score to 80.5% (7.7% point absolute improvement), MultiNLI accuracy to 86.7% (4.6% absolute improvement), SQuAD v1.1 question answering Test F1 to 93.2 (1.5 point absolute improvement) and SQuAD v2.0 Test F1 to 83.1 (5.1 point absolute improvement)."
84
+ #wrapper.fill(bert_abstract)
85
+ wrapper.fill(context)
86
 
87
  #question = "What does the 'B' in BERT stand for?"
88
  question = st.text_area('Enter your question...')
 
89
  answer=answer_question(question, bert_abstract)
90
+ st.text(answer)
91
+ while st.text_area().lower()!='q':
92
+ question = st.text_area('Enter your question...')
93
+ answer=answer_question(question, bert_abstract)
94
+ st.text(answer)
95
+ if st.text_area() =='q':
96
+ break
97
+
98
+
99
+
100