Spaces:
Runtime error
Runtime error
Commit
·
b1533be
1
Parent(s):
5a1bfb4
Update app.py
Browse files
app.py
CHANGED
@@ -39,6 +39,7 @@ model3 = torch.load("model3.pt", map_location=torch.device('cpu'))
|
|
39 |
model4 = torch.load("model4.pt", map_location=torch.device('cpu'))
|
40 |
model5 = torch.load("model5.pt", map_location=torch.device('cpu'))
|
41 |
model6 = torch.load("model6.pt", map_location=torch.device('cpu'))
|
|
|
42 |
|
43 |
def fn(glycan, model):
|
44 |
# Draw graph
|
@@ -69,6 +70,9 @@ def fn(glycan, model):
|
|
69 |
elif model == "Hierarchy substitution":
|
70 |
model_pred = model6
|
71 |
model_pred.eval()
|
|
|
|
|
|
|
72 |
else:
|
73 |
model_pred = model2
|
74 |
model_pred.eval()
|
@@ -97,7 +101,7 @@ def fn(glycan, model):
|
|
97 |
|
98 |
demo = gr.Interface(
|
99 |
fn=fn,
|
100 |
-
inputs=[gr.Textbox(label="Glycan sequence", value="Man(a1-2)Man(a1-3)[Man(a1-3)Man(a1-6)]Man(b1-4)GlcNAc(b1-4)GlcNAc"), gr.Radio(label="Model",choices=["No data augmentation", "Random node deletion", "Random edge deletion", "Ensemble", "Bootstrap Ensemble", "Hierarchy substitution"])],
|
101 |
outputs=[gr.Label(num_top_classes=15, label="Prediction"), gr.Image(label="Glycan graph")],
|
102 |
allow_flagging="never",
|
103 |
title="SweetNet demo",
|
|
|
39 |
model4 = torch.load("model4.pt", map_location=torch.device('cpu'))
|
40 |
model5 = torch.load("model5.pt", map_location=torch.device('cpu'))
|
41 |
model6 = torch.load("model6.pt", map_location=torch.device('cpu'))
|
42 |
+
model7 = torch.load("model7.pt", map_location=torch.device('cpu'))
|
43 |
|
44 |
def fn(glycan, model):
|
45 |
# Draw graph
|
|
|
70 |
elif model == "Hierarchy substitution":
|
71 |
model_pred = model6
|
72 |
model_pred.eval()
|
73 |
+
elif model == "Adjusted class weights":
|
74 |
+
model_pred = model7
|
75 |
+
model_pred.eval()
|
76 |
else:
|
77 |
model_pred = model2
|
78 |
model_pred.eval()
|
|
|
101 |
|
102 |
demo = gr.Interface(
|
103 |
fn=fn,
|
104 |
+
inputs=[gr.Textbox(label="Glycan sequence", value="Man(a1-2)Man(a1-3)[Man(a1-3)Man(a1-6)]Man(b1-4)GlcNAc(b1-4)GlcNAc"), gr.Radio(label="Model",choices=["No data augmentation", "Random node deletion", "Random edge deletion", "Ensemble", "Bootstrap Ensemble", "Hierarchy substitution", "Adjusted class wqeights"])],
|
105 |
outputs=[gr.Label(num_top_classes=15, label="Prediction"), gr.Image(label="Glycan graph")],
|
106 |
allow_flagging="never",
|
107 |
title="SweetNet demo",
|