Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,45 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
from TransformationQA_ZongqianLi.transformationqa import create_qa_database
|
|
|
|
|
|
|
4 |
|
5 |
st.markdown("# π Auto-generating Question-Answering Datasets with Domain-Specific Knowledge for Language Models in Scientific Tasks", unsafe_allow_html=True)
|
6 |
|
|
|
|
|
|
|
7 |
# Transformation Algorithm
|
|
|
8 |
st.markdown('## π₯οΈ QA Dataset Auto Generation', unsafe_allow_html=True)
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
# Question Answering
|
|
|
11 |
st.markdown('## π Question Answering', unsafe_allow_html=True)
|
12 |
st.markdown('### Select a model: ', unsafe_allow_html=True)
|
13 |
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
from TransformationQA_ZongqianLi.transformationqa import create_qa_database
|
4 |
+
from numpy import linspace
|
5 |
+
import jsonlines
|
6 |
+
import json
|
7 |
|
8 |
st.markdown("# π Auto-generating Question-Answering Datasets with Domain-Specific Knowledge for Language Models in Scientific Tasks", unsafe_allow_html=True)
|
9 |
|
10 |
+
|
11 |
+
|
12 |
+
##########
|
13 |
# Transformation Algorithm
|
14 |
+
##########
|
15 |
st.markdown('## π₯οΈ QA Dataset Auto Generation', unsafe_allow_html=True)
|
16 |
|
17 |
+
cde_lst = ["./CDE_properties.jsonl"]
|
18 |
+
paper_lst = ["./reference_paper.json"]
|
19 |
+
|
20 |
+
st.session_state['cde'] = "./CDE_properties.jsonl"
|
21 |
+
st.session_state['cde'] = st.selectbox("ChemDataExtractor generated database path:", cde_lst)
|
22 |
+
st.write("Example of the ChemDataExtractor generated database: ")
|
23 |
+
with open(st.session_state['cde'], 'r') as file:
|
24 |
+
for line in file:
|
25 |
+
json_data = json.loads(line.strip())
|
26 |
+
json_string = json.dumps(json_data, indent=4)
|
27 |
+
st.text_area("", value=json_string, height=100)
|
28 |
+
|
29 |
+
paper = st.selectbox("Paper collection path:", paper_lst)
|
30 |
+
|
31 |
+
databases = []
|
32 |
+
with open(args.databases_location,'r+', encoding = "utf-8") as f:
|
33 |
+
for item in jsonlines.Reader(f):
|
34 |
+
databases.append(item)
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
##########
|
41 |
# Question Answering
|
42 |
+
##########
|
43 |
st.markdown('## π Question Answering', unsafe_allow_html=True)
|
44 |
st.markdown('### Select a model: ', unsafe_allow_html=True)
|
45 |
|