Spaces:
Runtime error
Runtime error
shripadbhat
commited on
Commit
•
9842783
1
Parent(s):
b36e6d7
Update app.py
Browse files
app.py
CHANGED
@@ -44,30 +44,26 @@ def fetch_answers(question, document ):
|
|
44 |
|
45 |
return top_5_query_paragraph_answer_list
|
46 |
|
47 |
-
|
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 |
-
|
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 |
|
|
|
44 |
|
45 |
return top_5_query_paragraph_answer_list
|
46 |
|
47 |
+
st.text("Loading the models...")
|
|
|
|
|
|
|
|
|
48 |
my_bar = st.progress(0)
|
|
|
|
|
49 |
model_name = "MaRiOrOsSi/t5-base-finetuned-question-answering"
|
50 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
51 |
+
model = AutoModelWithLMHead.from_pretrained(model_name)
|
52 |
+
my_bar.progress(25)
|
|
|
|
|
53 |
sentence_segmenter = pysbd.Segmenter(language='en',clean=False)
|
|
|
54 |
my_bar.progress(50)
|
55 |
+
passage_retreival_model = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2')
|
|
|
56 |
my_bar.progress(75)
|
57 |
+
qa_model = pipeline("question-answering",'a-ware/bart-squadv2')
|
58 |
+
my_bar.progress(100)
|
59 |
+
st.text('Models Loaded')
|
60 |
+
|
61 |
+
st.title('Document Question Answering System')
|
62 |
+
query = st.text_area("Query", "", height=25)
|
63 |
+
document = st.text_area("Document Text", "", height=100)
|
64 |
|
65 |
if st.button("Get Answers From Document"):
|
66 |
|
67 |
st.markdown(fetch_answers(query, document))
|
|
|
68 |
|
69 |
|