Spaces:
Runtime error
Runtime error
Aakash Goel
commited on
Commit
·
c02b23b
1
Parent(s):
5148ec6
page views
Browse files- code/qa.py +15 -1
code/qa.py
CHANGED
@@ -8,6 +8,18 @@ def load_model():
|
|
8 |
question_answerer = pipeline('question-answering')
|
9 |
return question_answerer
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
def load_file():
|
12 |
"""Load text from file"""
|
13 |
uploaded_file = st.file_uploader("Upload Files",type=['txt'])
|
@@ -17,6 +29,8 @@ def load_file():
|
|
17 |
raw_text = str(uploaded_file.read(),"utf-8")
|
18 |
return raw_text
|
19 |
|
|
|
|
|
20 |
# Loading Model
|
21 |
question_answerer =load_model()
|
22 |
|
@@ -68,5 +82,5 @@ if raw_text != None and raw_text != '':
|
|
68 |
except:
|
69 |
st.write("FAIL2")
|
70 |
import os
|
71 |
-
st.dataframe(pd.read_csv("results/df_log_file.tsv",sep="\t").
|
72 |
|
|
|
8 |
question_answerer = pipeline('question-answering')
|
9 |
return question_answerer
|
10 |
|
11 |
+
@st.cache(allow_output_mutation=True)
|
12 |
+
def Pageviews():
|
13 |
+
return []
|
14 |
+
|
15 |
+
pageviews=Pageviews()
|
16 |
+
pageviews.append('dummy')
|
17 |
+
|
18 |
+
try:
|
19 |
+
st.markdown('Page viewed = {} times.'.format(len(pageviews)))
|
20 |
+
except ValueError:
|
21 |
+
st.markdown('Page viewed = {} times.'.format(1))
|
22 |
+
|
23 |
def load_file():
|
24 |
"""Load text from file"""
|
25 |
uploaded_file = st.file_uploader("Upload Files",type=['txt'])
|
|
|
29 |
raw_text = str(uploaded_file.read(),"utf-8")
|
30 |
return raw_text
|
31 |
|
32 |
+
|
33 |
+
|
34 |
# Loading Model
|
35 |
question_answerer =load_model()
|
36 |
|
|
|
82 |
except:
|
83 |
st.write("FAIL2")
|
84 |
import os
|
85 |
+
st.dataframe(pd.read_csv("results/df_log_file.tsv",sep="\t").tail(10))
|
86 |
|