Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,24 @@
|
|
1 |
-
import
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from Q_A import QuestionAnswering
|
3 |
+
|
4 |
+
st.title('Answering Question from a Document with Reference Text')
|
5 |
+
st.write("Loading the models...")
|
6 |
+
qa = QuestionAnswering()
|
7 |
+
st.write('Models Loaded')
|
8 |
+
|
9 |
+
|
10 |
+
document_text = st.text_area("Document Text", "", height=100)
|
11 |
+
query = st.text_input("Query")
|
12 |
+
|
13 |
+
|
14 |
+
#if st.button("Get Answers From Document"):
|
15 |
+
if len(document_text.strip()) > 0 and len(query.strip()) > 0:
|
16 |
+
st.write('Fetching answer...')
|
17 |
+
answers_lines = qa.fetch_answers(query, document_text).splitlines()
|
18 |
+
answer_first = answers_lines[0]
|
19 |
+
reference_first = answers_lines[1]
|
20 |
+
st.write('Check the answer below...with reference text')
|
21 |
+
st.header("ANSWER: "+answer_first)
|
22 |
+
st.subheader("REFERENCE: "+reference_first)
|
23 |
+
#st.markdown()
|
24 |
+
|