Spaces:
Runtime error
Runtime error
Aakash Goel
commited on
Commit
·
c3c9fc4
1
Parent(s):
c74c287
log download
Browse files- code/qa.py +12 -3
code/qa.py
CHANGED
@@ -2,6 +2,7 @@ import streamlit as st
|
|
2 |
from transformers import pipeline
|
3 |
import pandas as pd
|
4 |
import datetime
|
|
|
5 |
|
6 |
@st.cache(allow_output_mutation = True)
|
7 |
def load_model():
|
@@ -20,7 +21,15 @@ def load_model():
|
|
20 |
# st.markdown('Page viewed = {} times.'.format(1))
|
21 |
|
22 |
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
def load_file():
|
26 |
"""Load text from file"""
|
@@ -75,12 +84,12 @@ if raw_text != None and raw_text != '':
|
|
75 |
res_df = pd.DataFrame({"TimeStamp":[str(datetime.datetime.now())],\
|
76 |
"Question":[question],\
|
77 |
"Input":[str(raw_text)],"Answer":[str(answer["answer"])],"Score":[str(answer["score"])]})
|
78 |
-
st.write("PASS1")
|
79 |
except:
|
80 |
st.write("FAIL1")
|
81 |
try:
|
82 |
res_df.to_csv(output_path, mode='a', index=False, sep="\t", header= not os.path.exists(output_path))
|
83 |
-
st.write("PASS2")
|
84 |
except:
|
85 |
st.write("FAIL2")
|
86 |
import os
|
|
|
2 |
from transformers import pipeline
|
3 |
import pandas as pd
|
4 |
import datetime
|
5 |
+
import base64
|
6 |
|
7 |
@st.cache(allow_output_mutation = True)
|
8 |
def load_model():
|
|
|
21 |
# st.markdown('Page viewed = {} times.'.format(1))
|
22 |
|
23 |
|
24 |
+
def csv_downloader(data):
|
25 |
+
csvfile = data.to_csv()
|
26 |
+
b64 = base64.b64encode(csvfile.encode()).decode()
|
27 |
+
new_filename = "results/df_log_file.tsv"
|
28 |
+
st.markdown("#### Download File ###")
|
29 |
+
href = f'<a href="data:file/tsv;base64,{b64}" download="{new_filename}">Click Here!!</a>'
|
30 |
+
st.markdown(href,unsafe_allow_html=True)
|
31 |
+
|
32 |
+
st.markdown('')
|
33 |
|
34 |
def load_file():
|
35 |
"""Load text from file"""
|
|
|
84 |
res_df = pd.DataFrame({"TimeStamp":[str(datetime.datetime.now())],\
|
85 |
"Question":[question],\
|
86 |
"Input":[str(raw_text)],"Answer":[str(answer["answer"])],"Score":[str(answer["score"])]})
|
87 |
+
#st.write("PASS1")
|
88 |
except:
|
89 |
st.write("FAIL1")
|
90 |
try:
|
91 |
res_df.to_csv(output_path, mode='a', index=False, sep="\t", header= not os.path.exists(output_path))
|
92 |
+
#st.write("PASS2")
|
93 |
except:
|
94 |
st.write("FAIL2")
|
95 |
import os
|