Spaces:
Runtime error
Runtime error
Commit ·
b36e6d7
1
Parent(s): 00a0dbb
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,7 +28,6 @@ def fetch_answers(question, document ):
|
|
| 28 |
|
| 29 |
|
| 30 |
model_input = f"question: {query} context: {evidence_sentence}"
|
| 31 |
-
#output_answer = text2text_generator(model_input)[0]['generated_text']
|
| 32 |
encoded_input = tokenizer([model_input],
|
| 33 |
return_tensors='pt',
|
| 34 |
max_length=512,
|
|
@@ -49,26 +48,26 @@ def fetch_answers(question, document ):
|
|
| 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 |
my_bar = st.progress(0)
|
|
|
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
model_name = "MaRiOrOsSi/t5-base-finetuned-question-answering"
|
| 59 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 60 |
-
model = AutoModelWithLMHead.from_pretrained(model_name)
|
| 61 |
|
| 62 |
-
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
| 67 |
|
| 68 |
-
|
|
|
|
|
|
|
| 69 |
|
| 70 |
st.markdown(fetch_answers(query, document))
|
| 71 |
-
|
| 72 |
my_bar.progress(100)
|
| 73 |
|
| 74 |
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
model_input = f"question: {query} context: {evidence_sentence}"
|
|
|
|
| 31 |
encoded_input = tokenizer([model_input],
|
| 32 |
return_tensors='pt',
|
| 33 |
max_length=512,
|
|
|
|
| 48 |
st.title('Document Question Answering System')
|
| 49 |
query = st.text_area("Query", "", height=25)
|
| 50 |
document = st.text_area("Document Text", "", height=100)
|
| 51 |
+
st.text("Progress Bar")
|
| 52 |
my_bar = st.progress(0)
|
| 53 |
+
my_bar.progress(10)
|
| 54 |
|
| 55 |
+
model_name = "MaRiOrOsSi/t5-base-finetuned-question-answering"
|
| 56 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 57 |
+
model = AutoModelWithLMHead.from_pretrained(model_name)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
+
my_bar.progress(25)
|
| 60 |
|
| 61 |
+
sentence_segmenter = pysbd.Segmenter(language='en',clean=False)
|
| 62 |
+
passage_retreival_model = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2')
|
| 63 |
+
my_bar.progress(50)
|
| 64 |
+
qa_model = pipeline("question-answering",'a-ware/bart-squadv2')
|
| 65 |
|
| 66 |
+
my_bar.progress(75)
|
| 67 |
+
|
| 68 |
+
if st.button("Get Answers From Document"):
|
| 69 |
|
| 70 |
st.markdown(fetch_answers(query, document))
|
|
|
|
| 71 |
my_bar.progress(100)
|
| 72 |
|
| 73 |
|