Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
820aeb2e
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
820aeb2e
编写于
2月 12, 2023
作者:
D
DanielYang
提交者:
GitHub
2月 12, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test=develop, test=update_app (#5716)
上级
1fbf4a3a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
17 deletion
+17
-17
modelcenter/PP-HelixFold/APP/app.py
modelcenter/PP-HelixFold/APP/app.py
+17
-17
未找到文件。
modelcenter/PP-HelixFold/APP/app.py
浏览文件 @
820aeb2e
import
gradio
as
gr
import
gradio
as
gr
import
os
import
os
def
molecule
(
input_pdb
):
def
molecule
(
input_pdb
):
mol
=
read_mol
(
input_pdb
)
mol
=
read_mol
(
input_pdb
)
x
=
(
x
=
(
"""<!DOCTYPE html>
"""<!DOCTYPE html>
<html>
<html>
<head>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
...
@@ -24,14 +24,13 @@ def molecule(input_pdb):
...
@@ -24,14 +24,13 @@ def molecule(input_pdb):
}
}
</style>
</style>
<script src="https://3Dmol.csb.pitt.edu/build/3Dmol-min.js"></script>
<script src="https://3Dmol.csb.pitt.edu/build/3Dmol-min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.3.min.js" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
</head>
</head>
<body>
<body>
<div id="container" class="mol-container"></div>
<div id="container" class="mol-container"></div>
<script>
<script>
let pdb = `"""
let pdb = `"""
+
mol
+
"""`
+
mol
+
"""`
$(document).ready(function () {
$(document).ready(function () {
let element = $("#container");
let element = $("#container");
...
@@ -44,8 +43,7 @@ def molecule(input_pdb):
...
@@ -44,8 +43,7 @@ def molecule(input_pdb):
viewer.zoom(1, 1000); /* slight zoom */
viewer.zoom(1, 1000); /* slight zoom */
})
})
</script>
</script>
</body></html>"""
</body></html>"""
)
)
return
f
"""<iframe style="width: 100%; height: 600px" name="result" allow="midi; geolocation; microphone; camera;
return
f
"""<iframe style="width: 100%; height: 600px" name="result" allow="midi; geolocation; microphone; camera;
display-capture; encrypted-media;" sandbox="allow-modals allow-forms
display-capture; encrypted-media;" sandbox="allow-modals allow-forms
...
@@ -53,6 +51,7 @@ def molecule(input_pdb):
...
@@ -53,6 +51,7 @@ def molecule(input_pdb):
allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
allowpaymentrequest="" frameborder="0" srcdoc='
{
x
}
'></iframe>"""
allowpaymentrequest="" frameborder="0" srcdoc='
{
x
}
'></iframe>"""
def
get_pdb
(
pdb_code
=
""
,
filepath
=
""
):
def
get_pdb
(
pdb_code
=
""
,
filepath
=
""
):
if
pdb_code
is
None
or
pdb_code
==
""
:
if
pdb_code
is
None
or
pdb_code
==
""
:
try
:
try
:
...
@@ -73,23 +72,24 @@ def read_mol(molpath):
...
@@ -73,23 +72,24 @@ def read_mol(molpath):
return
mol
return
mol
def
update
(
fastaName
=
''
,
fastaContent
=
''
):
def
update
(
fastaName
=
''
,
fastaContent
=
''
):
if
(
fastaName
==
''
):
if
(
fastaName
==
''
):
return
None
return
None
else
:
else
:
return
molecule
(
fastaName
+
"_pred.pdb"
)
return
molecule
(
fastaName
+
"_pred.pdb"
)
demo
=
gr
.
Blocks
()
demo
=
gr
.
Blocks
()
with
demo
:
with
demo
:
gr
.
Markdown
(
"# PP-HelixFold
Protein Structure Prediction
Demo"
)
gr
.
Markdown
(
"# PP-HelixFold Demo"
)
with
gr
.
Row
():
with
gr
.
Row
():
with
gr
.
Box
():
with
gr
.
Box
():
fastaName
=
gr
.
Textbox
(
interactive
=
False
,
label
=
'Fasta label'
)
fastaName
=
gr
.
Textbox
(
interactive
=
False
,
label
=
'Fasta label'
)
fastaContent
=
gr
.
Textbox
(
interactive
=
False
,
label
=
'Fasta content'
)
fastaContent
=
gr
.
Textbox
(
interactive
=
False
,
label
=
'Fasta content'
)
gr
.
Examples
([[
"T1026"
,
read_mol
(
"T1026.fasta"
)],[
"T1037"
,
read_mol
(
"T1037.fasta"
)]],
[
fastaName
,
fastaContent
])
gr
.
Examples
([[
"T1026"
,
read_mol
(
"T1026.fasta"
)],
[
"T1037"
,
read_mol
(
"T1037.fasta"
)]],
[
fastaName
,
fastaContent
])
btn
=
gr
.
Button
(
"Predict"
)
btn
=
gr
.
Button
(
"Predict"
)
mol
=
gr
.
HTML
()
mol
=
gr
.
HTML
()
btn
.
click
(
fn
=
update
,
inputs
=
[
fastaName
,
fastaContent
],
outputs
=
mol
)
btn
.
click
(
fn
=
update
,
inputs
=
[
fastaName
,
fastaContent
],
outputs
=
mol
)
demo
.
launch
()
demo
.
launch
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录