fix Reaction cord
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@ -6,4 +6,6 @@ __pycache__
|
||||
*.mp3
|
||||
*.mp4
|
||||
*.log
|
||||
test
|
||||
test
|
||||
.venv
|
||||
uv.lock
|
@ -1,8 +1,7 @@
|
||||
[project]
|
||||
name = "tmp2"
|
||||
name = "Reaction-Cord"
|
||||
version = "0.1.0"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
dependencies = [
|
||||
"matplotlib>=3.10.5",
|
||||
|
@ -25,14 +25,18 @@ def search_compound(query):
|
||||
except Exception:
|
||||
st.error("使用smiles精确查询失败")
|
||||
# 尝试通过化学式搜索
|
||||
if not (isinstance(compounds, list) and len(compounds) != 0):
|
||||
# 尝试通过名称搜索
|
||||
try:
|
||||
compounds = pcp.get_compounds(query, 'name', listkey_count=3)
|
||||
except Exception:
|
||||
st.error("使用名称查询失败")
|
||||
|
||||
if not (isinstance(compounds, list) and len(compounds) != 0):
|
||||
try:
|
||||
compounds = pcp.get_compounds(query, 'formula', listkey_count=3)
|
||||
except Exception:
|
||||
st.error("使用化学式精确查询失败")
|
||||
if not (isinstance(compounds, list) and len(compounds) != 0):
|
||||
# 尝试通过名称搜索
|
||||
compounds = pcp.get_compounds(query, 'name', listkey_count=3)
|
||||
|
||||
if isinstance(compounds, list) and len(compounds) > 0:
|
||||
st.info("成功查询物质基本信息,正在获取更多数据。")
|
||||
|
Reference in New Issue
Block a user