Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ fpretrain_lst = ["None", "-scsmall", "-scmedium", "-sclarge"]
|
|
20 |
finetune_lst = ["-squad", "-scqa1", "-scqa2"]
|
21 |
|
22 |
# 为每个选项创建下拉菜单
|
23 |
-
st.markdown(f'bert', unsafe_allow_html=True)
|
24 |
size = st.selectbox("Choose a model size:", size_lst)
|
25 |
cased = st.selectbox("Whether distinguish upper and lowercase letters:", cased_lst)
|
26 |
fpretrain = st.selectbox("Further pretrained on a solar cell corpus:", fpretrain_lst)
|
@@ -119,23 +119,16 @@ if st.button('Extract the property'):
|
|
119 |
st.markdown('## 🖥️ QA Dataset Auto Generation', unsafe_allow_html=True)
|
120 |
st.markdown('### Algorithm Input', unsafe_allow_html=True)
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
st.session_state['cde'] = "./CDE_properties.jsonl"
|
126 |
-
st.session_state['cde'] = st.selectbox("ChemDataExtractor generated database path:", cde_lst)
|
127 |
-
st.write("Example of the data record in the ChemDataExtractor generated database: ")
|
128 |
-
with open(st.session_state['cde'], 'r') as file:
|
129 |
for line in file:
|
130 |
json_data = json.loads(line.strip())
|
131 |
json_string = json.dumps(json_data, indent=4)
|
132 |
st.text_area("", value=json_string, height=200)
|
133 |
break
|
134 |
|
135 |
-
st.
|
136 |
-
|
137 |
-
st.write("Example of the paper collection: ")
|
138 |
-
with open(st.session_state['paper'],'r+', encoding = "utf-8") as f:
|
139 |
string = f.read()
|
140 |
json_data = json.loads(string)
|
141 |
json_string = json.dumps(json_data, indent=4)
|
@@ -143,6 +136,26 @@ with open(st.session_state['paper'],'r+', encoding = "utf-8") as f:
|
|
143 |
|
144 |
st.markdown('### Algorithm Output', unsafe_allow_html=True)
|
145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
st.write("To be updated")
|
147 |
|
148 |
|
|
|
20 |
finetune_lst = ["-squad", "-scqa1", "-scqa2"]
|
21 |
|
22 |
# 为每个选项创建下拉菜单
|
23 |
+
st.markdown(f'###### bert', unsafe_allow_html=True)
|
24 |
size = st.selectbox("Choose a model size:", size_lst)
|
25 |
cased = st.selectbox("Whether distinguish upper and lowercase letters:", cased_lst)
|
26 |
fpretrain = st.selectbox("Further pretrained on a solar cell corpus:", fpretrain_lst)
|
|
|
119 |
st.markdown('## 🖥️ QA Dataset Auto Generation', unsafe_allow_html=True)
|
120 |
st.markdown('### Algorithm Input', unsafe_allow_html=True)
|
121 |
|
122 |
+
st.markdown(f###### Example of the data record in the ChemDataExtractor generated database: ', unsafe_allow_html=True)
|
123 |
+
with open("./CDE_properties.jsonl", 'r') as file:
|
|
|
|
|
|
|
|
|
|
|
124 |
for line in file:
|
125 |
json_data = json.loads(line.strip())
|
126 |
json_string = json.dumps(json_data, indent=4)
|
127 |
st.text_area("", value=json_string, height=200)
|
128 |
break
|
129 |
|
130 |
+
st.markdown('###### Example of the paper collection: ', unsafe_allow_html=True)
|
131 |
+
with open("./reference_paper.json",'r+', encoding = "utf-8") as f:
|
|
|
|
|
132 |
string = f.read()
|
133 |
json_data = json.loads(string)
|
134 |
json_string = json.dumps(json_data, indent=4)
|
|
|
136 |
|
137 |
st.markdown('### Algorithm Output', unsafe_allow_html=True)
|
138 |
|
139 |
+
st.markdown('###### Extracted first-turn QA pairs: ', unsafe_allow_html=True)
|
140 |
+
file_path = "./output_qa.jsonl"
|
141 |
+
json_list = []
|
142 |
+
with open(file_path, 'r', encoding="utf-8") as file:
|
143 |
+
for line in file:
|
144 |
+
json_dict = json.loads(line.strip())
|
145 |
+
json_list.append(json_dict)
|
146 |
+
json_string = json.dumps(json_list, indent=4)
|
147 |
+
st.text_area("", value=json_string, height=200)
|
148 |
+
|
149 |
+
st.markdown('###### Extracted second-turn QA pairs: ', unsafe_allow_html=True)
|
150 |
+
file_path = "output_secondqa.jsonl"
|
151 |
+
json_list = []
|
152 |
+
with open(file_path, 'r', encoding="utf-8") as file:
|
153 |
+
for line in file:
|
154 |
+
json_dict = json.loads(line.strip())
|
155 |
+
json_list.append(json_dict)
|
156 |
+
json_string = json.dumps(json_list, indent=4)
|
157 |
+
st.text_area("", value=json_string, height=200)
|
158 |
+
|
159 |
st.write("To be updated")
|
160 |
|
161 |
|