Spaces:
Running
Running
File size: 1,665 Bytes
3c50437 514575e 3c50437 eda1603 3c50437 eda1603 a7f5d18 3c50437 a7f5d18 3c50437 a7f5d18 3c50437 eda1603 3c50437 5ae80ee eda1603 a7f5d18 eda1603 a7f5d18 eda1603 a7f5d18 2aa230e a7f5d18 2aa230e eda1603 2aa230e a7f5d18 514575e a7f5d18 2aa230e a7f5d18 2aa230e 3c50437 a7f5d18 514575e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
import gradio as gr
from gradio_molecule3d import Molecule3D
example = Molecule3D().example_value()
reps = [
{
"model": 0,
"chain": "",
"resname": "",
"style": "cartoon",
"color": "hydrophobicity",
# "residue_range": "",
"around": 0,
"byres": False,
# "visible": False,
# "opacity": 0.5
}
]
def predict(x):
print("predict function", x)
print(x.name)
return x
# def update_color(mol, color):
# reps[0]['color'] = color
# print(reps)
# return Molecule3D(mol, reps=reps)
with gr.Blocks() as demo:
gr.Markdown("# Molecule3D")
# color_choices = ['redCarbon', 'greenCarbon', 'orangeCarbon', 'blackCarbon', 'blueCarbon', 'grayCarbon', 'cyanCarbon']
inp = Molecule3D(label="Molecule3D", reps=reps)
# cdr_color = gr.Dropdown(choices=color_choices, label="CDR color", value='redCarbon')
out = Molecule3D(label="Output", reps=reps)
# cdr_color.change(update_color, inputs=[inp,cdr_color], outputs=out)
btn = gr.Button("Predict")
gr.Markdown("""
You can configure the default rendering of the molecule by adding a list of representations
<pre>
reps = [
{
"model": 0,
"style": "cartoon",
"color": "whiteCarbon",
"residue_range": "",
"around": 0,
"opacity":1
},
{
"model": 0,
"chain": "A",
"resname": "HIS",
"style": "stick",
"color": "red"
}
]
</pre>
""")
btn.click(predict, inputs=inp, outputs=out)
if __name__ == "__main__":
demo.launch()
|