Spaces:
Running
Running
simonduerr
commited on
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import gradio as gr
|
3 |
+
from gradio_moleculeview import moleculeview
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
def predict(input_mol, view_str, chains):
|
9 |
+
return "svg"
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
with gr.Blocks() as demo:
|
16 |
+
gr.Markdown("# Molecule3D")
|
17 |
+
inp = moleculeview(label="Molecule3D")
|
18 |
+
|
19 |
+
view_str = gr.Textbox("viewMatrixResult", label="View Matrix", visible=False)
|
20 |
+
chains = gr.Textbox("chainsResult", label="Chains", visible=False)
|
21 |
+
|
22 |
+
|
23 |
+
btn = gr.Button("Predict")
|
24 |
+
html = gr.HTML("")
|
25 |
+
btn.click(None, [], [view_str, chains], js="() => [document.getElementById('viewMatrixResult').value, document.getElementById('chains').value]") #
|
26 |
+
# on change of chains trigger, rendering
|
27 |
+
chains.change(predict, [inp, view_str, chains], html)
|
28 |
+
|
29 |
+
|
30 |
+
if __name__ == "__main__":
|
31 |
+
demo.launch()
|