Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,255 +1,256 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
import pandas as pd
|
| 3 |
-
import json
|
| 4 |
-
from tempfile import NamedTemporaryFile
|
| 5 |
-
|
| 6 |
-
import NDfilter
|
| 7 |
-
|
| 8 |
-
## 核素筛选
|
| 9 |
-
def process_filters(Z_min, Z_max, Z_oe_idx, N_min, N_max, N_oe_idx, A_min, A_max, A_oe_idx, hl_enable_idx, hl_min, hl_min_unit, hl_max, hl_max_unit, dm_enable_idx, decay_modes):
|
| 10 |
-
|
| 11 |
-
filtered_data = NDfilter.nuclidesFilterZNA(nuclides_data, Z_min, Z_max, Z_oe_idx, N_min, N_max, N_oe_idx, A_min, A_max, A_oe_idx)
|
| 12 |
-
|
| 13 |
-
# 根据母核半衰期进行筛选
|
| 14 |
-
if hl_enable_idx == 1:
|
| 15 |
-
hl_min_sec = HLunit_convert(hl_min, hl_min_unit)
|
| 16 |
-
hl_max_sec = HLunit_convert(hl_max, hl_max_unit)
|
| 17 |
-
filtered_data = NDfilter.nuclidesFilterHalflife(filtered_data, hl_min_sec, hl_max_sec)
|
| 18 |
-
|
| 19 |
-
# 根据衰变模式进行筛选
|
| 20 |
-
if dm_enable_idx > 0 and decay_modes:
|
| 21 |
-
filtered_data = NDfilter.nuclidesFilterDecayModes(filtered_data, dm_enable_idx, decay_modes)
|
| 22 |
-
|
| 23 |
-
# 结果处理
|
| 24 |
-
if len(filtered_data) == 0:
|
| 25 |
-
result_text = "没有找到符合条件的核素"
|
| 26 |
-
result_file_path = None
|
| 27 |
-
else:
|
| 28 |
-
result_text = f"找到 {len(filtered_data)} 个符合条件的核素"
|
| 29 |
-
with NamedTemporaryFile(suffix=".json", delete=False, mode='w') as file:
|
| 30 |
-
json.dump(filtered_data, file, indent=2)
|
| 31 |
-
result_file_path = file.name
|
| 32 |
-
return result_text, result_file_path
|
| 33 |
-
|
| 34 |
-
## 核素查找
|
| 35 |
-
def process_search(mode_idx, nom, z, n, a, preview_mode, file_type):
|
| 36 |
-
result = None
|
| 37 |
-
if mode_idx == 0:
|
| 38 |
-
result = NDfilter.nuclidesSearchingNom(nuclides_data, nom.replace(" ", ""))
|
| 39 |
-
elif mode_idx == 1:
|
| 40 |
-
if not (z == None or n == None):
|
| 41 |
-
result = NDfilter.nuclidesSearchingZN(nuclides_data, z, n)
|
| 42 |
-
elif mode_idx == 2:
|
| 43 |
-
if not (z == None or a == None):
|
| 44 |
-
result = NDfilter.nuclidesSearchingZA(nuclides_data, z, a)
|
| 45 |
-
elif mode_idx == 3:
|
| 46 |
-
if not (n == None or a == None):
|
| 47 |
-
result = NDfilter.nuclidesSearchingNA(nuclides_data, n, a)
|
| 48 |
-
|
| 49 |
-
## 结果处理
|
| 50 |
-
if result == None:
|
| 51 |
-
result_text = "没有找到此核素"
|
| 52 |
-
result_dataframe = None
|
| 53 |
-
result_file_path = None
|
| 54 |
-
else:
|
| 55 |
-
## 文本
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
gr.
|
| 205 |
-
|
| 206 |
-
gr.
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
|
|
|
| 255 |
demo.launch()
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import json
|
| 4 |
+
from tempfile import NamedTemporaryFile
|
| 5 |
+
|
| 6 |
+
import NDfilter
|
| 7 |
+
|
| 8 |
+
## 核素筛选
|
| 9 |
+
def process_filters(Z_min, Z_max, Z_oe_idx, N_min, N_max, N_oe_idx, A_min, A_max, A_oe_idx, hl_enable_idx, hl_min, hl_min_unit, hl_max, hl_max_unit, dm_enable_idx, decay_modes):
|
| 10 |
+
|
| 11 |
+
filtered_data = NDfilter.nuclidesFilterZNA(nuclides_data, Z_min, Z_max, Z_oe_idx, N_min, N_max, N_oe_idx, A_min, A_max, A_oe_idx)
|
| 12 |
+
|
| 13 |
+
# 根据母核半衰期进行筛选
|
| 14 |
+
if hl_enable_idx == 1:
|
| 15 |
+
hl_min_sec = HLunit_convert(hl_min, hl_min_unit)
|
| 16 |
+
hl_max_sec = HLunit_convert(hl_max, hl_max_unit)
|
| 17 |
+
filtered_data = NDfilter.nuclidesFilterHalflife(filtered_data, hl_min_sec, hl_max_sec)
|
| 18 |
+
|
| 19 |
+
# 根据衰变模式进行筛选
|
| 20 |
+
if dm_enable_idx > 0 and decay_modes:
|
| 21 |
+
filtered_data = NDfilter.nuclidesFilterDecayModes(filtered_data, dm_enable_idx, decay_modes)
|
| 22 |
+
|
| 23 |
+
# 结果处理
|
| 24 |
+
if len(filtered_data) == 0:
|
| 25 |
+
result_text = "没有找到符合条件的核素"
|
| 26 |
+
result_file_path = None
|
| 27 |
+
else:
|
| 28 |
+
result_text = f"找到 {len(filtered_data)} 个符合条件的核素"
|
| 29 |
+
with NamedTemporaryFile(suffix=".json", delete=False, mode='w') as file:
|
| 30 |
+
json.dump(filtered_data, file, indent=2)
|
| 31 |
+
result_file_path = file.name
|
| 32 |
+
return result_text, result_file_path
|
| 33 |
+
|
| 34 |
+
## 核素查找
|
| 35 |
+
def process_search(mode_idx, nom, z, n, a, preview_mode, file_type):
|
| 36 |
+
result = None
|
| 37 |
+
if mode_idx == 0:
|
| 38 |
+
result = NDfilter.nuclidesSearchingNom(nuclides_data, nom.replace(" ", ""))
|
| 39 |
+
elif mode_idx == 1:
|
| 40 |
+
if not (z == None or n == None):
|
| 41 |
+
result = NDfilter.nuclidesSearchingZN(nuclides_data, z, n)
|
| 42 |
+
elif mode_idx == 2:
|
| 43 |
+
if not (z == None or a == None):
|
| 44 |
+
result = NDfilter.nuclidesSearchingZA(nuclides_data, z, a)
|
| 45 |
+
elif mode_idx == 3:
|
| 46 |
+
if not (n == None or a == None):
|
| 47 |
+
result = NDfilter.nuclidesSearchingNA(nuclides_data, n, a)
|
| 48 |
+
|
| 49 |
+
## 结果处理
|
| 50 |
+
if result == None:
|
| 51 |
+
result_text = "没有找到此核素"
|
| 52 |
+
result_dataframe = None
|
| 53 |
+
result_file_path = None
|
| 54 |
+
else:
|
| 55 |
+
## 文本
|
| 56 |
+
name = result["name"]
|
| 57 |
+
result_text = f"{name}" + "\n\nnndc页面:\ngetdataset:\n" + f"https://www.nndc.bnl.gov/nudat3/getdataset.jsp?nucleus={name}&unc=NDS"
|
| 58 |
+
## temp
|
| 59 |
+
with open ("data/haveDecayPage.json",'r', encoding='utf-8') as file:
|
| 60 |
+
haveDecayPage = json.load(file)
|
| 61 |
+
if haveDecayPage[name]:
|
| 62 |
+
result_text = result_text + "\n\ndecaysearchdirect:\n" + f"https://www.nndc.bnl.gov/nudat3/decaysearchdirect.jsp?nuc={name}&unc=NDS"
|
| 63 |
+
|
| 64 |
+
## 预览表格
|
| 65 |
+
if preview_mode == 0:
|
| 66 |
+
result_dataframe = NDfilter.nuclideData_dict2dataframeCompact(result)
|
| 67 |
+
elif preview_mode == 1:
|
| 68 |
+
result_dataframe = NDfilter.nuclideData_dict2dataframe(result)
|
| 69 |
+
|
| 70 |
+
## 文件
|
| 71 |
+
if file_type == 0:
|
| 72 |
+
with NamedTemporaryFile(suffix=".json", delete=False, mode='w') as file:
|
| 73 |
+
json.dump(result, file, indent=2)
|
| 74 |
+
result_file_path = file.name
|
| 75 |
+
elif file_type == 1:
|
| 76 |
+
if preview_mode == 1:
|
| 77 |
+
tmpDataframe = result_dataframe
|
| 78 |
+
else:
|
| 79 |
+
tmpDataframe = NDfilter.nuclideData_dict2dataframe(result)
|
| 80 |
+
with NamedTemporaryFile(suffix=".csv", delete=False, mode='w') as file:
|
| 81 |
+
tmpDataframe.to_csv(file, index=False)
|
| 82 |
+
result_file_path = file.name
|
| 83 |
+
|
| 84 |
+
return result_text, result_dataframe, result_file_path
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
## 半衰期单位转换
|
| 88 |
+
def HLunit_convert(hl, hl_unit):
|
| 89 |
+
if hl_unit == "Stable":
|
| 90 |
+
hl_sec = None
|
| 91 |
+
else:
|
| 92 |
+
hl_sec = hl * HL_UNITS[hl_unit]
|
| 93 |
+
return hl_sec
|
| 94 |
+
|
| 95 |
+
## 处理查找页面输入组件激活情况
|
| 96 |
+
def update_inputs(mode_idx):
|
| 97 |
+
|
| 98 |
+
if mode_idx == 0: # 核素名称模式
|
| 99 |
+
return [gr.Textbox(interactive=True), gr.Number(interactive=False, value=None), gr.Number(interactive=False, value=None), gr.Number(interactive=False, value=None)]
|
| 100 |
+
elif mode_idx == 1: # Z+N模式
|
| 101 |
+
return [gr.Textbox(interactive=False, value=None), gr.Number(interactive=True), gr.Number(interactive=True), gr.Number(interactive=False, value=None)]
|
| 102 |
+
elif mode_idx == 2: # Z+A模式
|
| 103 |
+
return [gr.Textbox(interactive=False, value=None), gr.Number(interactive=True), gr.Number(interactive=False, value=None), gr.Number(interactive=True)]
|
| 104 |
+
elif mode_idx == 3: # N+A模式
|
| 105 |
+
return [gr.Textbox(interactive=False, value=None), gr.Number(interactive=False, value=None), gr.Number(interactive=True), gr.Number(interactive=True)]
|
| 106 |
+
else:
|
| 107 |
+
return [gr.Textbox(interactive=False, value=None), gr.Number(interactive=False, value=None), gr.Number(interactive=False, value=None), gr.Number(interactive=False, value=None)]
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
## 导入数据集
|
| 112 |
+
file_path = "data/nndc_nudat_data_export.json"
|
| 113 |
+
with open (file_path,'r', encoding='utf-8') as file:
|
| 114 |
+
nuclides_data = json.load(file)
|
| 115 |
+
|
| 116 |
+
## 半衰期单位转换字典
|
| 117 |
+
HL_UNITS = {"fs": 1e-15, "ps": 1e-12, "ns": 1e-9, "us": 1e-6, "ms": 1e-3, "s": 1, "m": 60, "h": 3600, "d": 86400, "y": 31557600, "ky": 31557600e3, "My": 31557600e6, "Gy": 31557600e9}
|
| 118 |
+
|
| 119 |
+
with gr.Blocks(title="核数据工具") as demo:
|
| 120 |
+
gr.Markdown("""
|
| 121 |
+
## 核数据工具
|
| 122 |
+
可能是用来处理核数据的相关工具??
|
| 123 |
+
目前功能有:核素筛选、核素查找。
|
| 124 |
+
""")
|
| 125 |
+
|
| 126 |
+
with gr.Tab("核素筛选"):
|
| 127 |
+
gr.Markdown("""
|
| 128 |
+
## 核素筛选
|
| 129 |
+
可以通过质子数(Z)、中子数(N)、质量数(A)以及母核半衰期、衰变模式等进行筛选
|
| 130 |
+
""")
|
| 131 |
+
with gr.Row():
|
| 132 |
+
with gr.Column(scale=1):
|
| 133 |
+
gr.Markdown("根据质子数(Z)、中子数(N)、质量数(A)进行筛选")
|
| 134 |
+
with gr.Column(scale=4):
|
| 135 |
+
with gr.Row():
|
| 136 |
+
with gr.Column(min_width=240):
|
| 137 |
+
gr.Markdown("质子数(Z)")
|
| 138 |
+
Z_min = gr.Number(label="最小值", precision=0)
|
| 139 |
+
Z_max = gr.Number(label="最大值", precision=0)
|
| 140 |
+
Z_oe = gr.Dropdown(["任意", "奇Z", "偶Z"], label="奇偶", type="index", interactive=True)
|
| 141 |
+
with gr.Column(min_width=240):
|
| 142 |
+
gr.Markdown("中子数(N)")
|
| 143 |
+
N_min = gr.Number(label="最小值", precision=0)
|
| 144 |
+
N_max = gr.Number(label="最大值", precision=0)
|
| 145 |
+
N_oe = gr.Dropdown(["任意", "奇N", "偶N"], label="奇偶", type="index", interactive=True)
|
| 146 |
+
with gr.Column(min_width=240):
|
| 147 |
+
gr.Markdown("质量数(A)")
|
| 148 |
+
A_min = gr.Number(label="最小值", precision=0)
|
| 149 |
+
A_max = gr.Number(label="最大值", precision=0)
|
| 150 |
+
A_oe = gr.Dropdown(["任意", "奇A", "偶A"], label="奇偶", type="index", interactive=True)
|
| 151 |
+
|
| 152 |
+
with gr.Row():
|
| 153 |
+
with gr.Column(scale=1):
|
| 154 |
+
gr.Markdown("根据母核半衰期进行筛选")
|
| 155 |
+
with gr.Column(scale=4):
|
| 156 |
+
with gr.Row():
|
| 157 |
+
hl_enable = gr.Radio(["不使用", "使用"], value="不使用", type="index", show_label=False)
|
| 158 |
+
hl_min = gr.Number(label="最小值", minimum=0.)
|
| 159 |
+
hl_min_unit = gr.Dropdown(["fs", "ps", "ns", "us", "ms", "s", "m", "h", "d", "y", "ky", "My", "Gy", "Stable"], value="fs", interactive=True)
|
| 160 |
+
hl_max = gr.Number(label="最大值", minimum=0.)
|
| 161 |
+
hl_max_unit = gr.Dropdown(["fs", "ps", "ns", "us", "ms", "s", "m", "h", "d", "y", "ky", "My", "Gy", "Stable"], value="Stable", interactive=True)
|
| 162 |
+
|
| 163 |
+
with gr.Row():
|
| 164 |
+
with gr.Column(scale=1):
|
| 165 |
+
gr.Markdown("根据衰变模式进行筛选")
|
| 166 |
+
with gr.Column(scale=4):
|
| 167 |
+
with gr.Row():
|
| 168 |
+
dm_enable_idx = gr.Radio(["不使用", "筛选包含所有以下所选衰变模式的核素(and)", "筛选包含任意以下所选衰变模式的核素(or)"], value="不使用", type="index", interactive=True, show_label=False)
|
| 169 |
+
with gr.Row():
|
| 170 |
+
decayModes = gr.CheckboxGroup(['B-', 'N', '2N', 'B-N', 'P', 'B-A', 'B-2N', 'B-3N', '2P', 'EC', 'A', 'B-4N', 'EC+B+', 'ECA', 'ECP', 'IT', 'EC2P', 'EC3P', 'ECAP', '3P', '2B-', 'ECSF', '14C', 'B-SF', '24NE', 'SF', '20O', '20NE', '25NE', '28MG', 'NE', '22NE', 'SI', 'MG', '34SI'], label="decayModes", interactive=True)
|
| 171 |
+
|
| 172 |
+
with gr.Row():
|
| 173 |
+
submit_btn = gr.Button("筛选", variant="primary")
|
| 174 |
+
reset_btn = gr.Button("重置条件", variant="primary")
|
| 175 |
+
|
| 176 |
+
with gr.Row():
|
| 177 |
+
result_text = gr.Textbox(label="筛选结果", interactive=False, show_copy_button=True)
|
| 178 |
+
result_file = gr.File(label="结果文件", interactive=False)
|
| 179 |
+
|
| 180 |
+
inputs = [
|
| 181 |
+
Z_min, Z_max, Z_oe,
|
| 182 |
+
N_min, N_max, N_oe,
|
| 183 |
+
A_min, A_max, A_oe,
|
| 184 |
+
hl_enable, hl_min, hl_min_unit, hl_max, hl_max_unit,
|
| 185 |
+
dm_enable_idx, decayModes
|
| 186 |
+
]
|
| 187 |
+
|
| 188 |
+
submit_btn.click(
|
| 189 |
+
fn=process_filters,
|
| 190 |
+
inputs=inputs,
|
| 191 |
+
outputs=[result_text, result_file]
|
| 192 |
+
)
|
| 193 |
+
|
| 194 |
+
reset_btn.click(
|
| 195 |
+
fn=lambda: [None,None,"任意"]*3 + ["不使用", None, "fs", None, "Stable"] + ["不使用", []],
|
| 196 |
+
outputs=inputs
|
| 197 |
+
)
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
with gr.Tab("核素查找"):
|
| 201 |
+
gr.Markdown("## 核素查找")
|
| 202 |
+
with gr.Row():
|
| 203 |
+
with gr.Column(scale=3):
|
| 204 |
+
searchingMode = gr.Radio(["核素名称", "质子数(Z)、中子数(N)", "质子数(Z)、质量数(A)", "中子数(N)、质量数(A)"], value="核素名称", label="查找模式", interactive=True, type="index")
|
| 205 |
+
gr.Markdown("### 根据核素名称查找")
|
| 206 |
+
nuclide_in = gr.Textbox(value=None, info="请输入由质量数及元素名称所组成的核素名称,示例:232Th、232TH、th232、232-Th、th-232等。\n只要不太离谱就能识别……大概?")
|
| 207 |
+
gr.Markdown("### 根据质子数(Z)、中子数(N)、质量数(A)查找")
|
| 208 |
+
with gr.Row():
|
| 209 |
+
Z_in = gr.Number(value=0, label="质子数(Z)", precision=0, interactive=False)
|
| 210 |
+
N_in = gr.Number(value=0, label="中子数(N)", precision=0, interactive=False)
|
| 211 |
+
A_in = gr.Number(value=0, label="质量数(A)", precision=0, interactive=False)
|
| 212 |
+
previewMode = gr.Radio(["紧凑", "常规"], value="紧凑", type="index", label="预览模式")
|
| 213 |
+
outputFileType = gr.Radio(["json", "csv"], value="json", type="index", label="导出文件格式")
|
| 214 |
+
with gr.Row():
|
| 215 |
+
submit_btn2 = gr.Button("查找", variant="primary")
|
| 216 |
+
reset_btn2 = gr.Button("重置条件", variant="primary")
|
| 217 |
+
|
| 218 |
+
with gr.Column(scale=2):
|
| 219 |
+
result_text2 = gr.Textbox(interactive=False, show_label=False)
|
| 220 |
+
preview_df = gr.Dataframe(label="数据预览", interactive=False)
|
| 221 |
+
result_file2 = gr.File()
|
| 222 |
+
|
| 223 |
+
searchingMode.change(
|
| 224 |
+
fn=update_inputs,
|
| 225 |
+
inputs=searchingMode,
|
| 226 |
+
outputs=[nuclide_in, Z_in, N_in, A_in]
|
| 227 |
+
)
|
| 228 |
+
|
| 229 |
+
inputs2 = [
|
| 230 |
+
searchingMode,
|
| 231 |
+
nuclide_in,
|
| 232 |
+
Z_in, N_in, A_in,
|
| 233 |
+
previewMode, outputFileType
|
| 234 |
+
]
|
| 235 |
+
|
| 236 |
+
submit_btn2.click(
|
| 237 |
+
fn=process_search,
|
| 238 |
+
inputs=inputs2,
|
| 239 |
+
outputs=[result_text2, preview_df, result_file2]
|
| 240 |
+
)
|
| 241 |
+
|
| 242 |
+
reset_btn2.click(
|
| 243 |
+
fn=lambda: [None]*4,
|
| 244 |
+
outputs=[nuclide_in, Z_in, N_in, A_in]
|
| 245 |
+
)
|
| 246 |
+
|
| 247 |
+
with gr.Tab("核素图绘制"):
|
| 248 |
+
gr.Markdown("""
|
| 249 |
+
## 核素图绘制
|
| 250 |
+
TO DO
|
| 251 |
+
""")
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
|
| 256 |
demo.launch()
|