Spaces:
Runtime error
Runtime error
dalexanderch
commited on
Commit
•
8a9a147
1
Parent(s):
aec7d72
Update app.py
Browse files
app.py
CHANGED
@@ -36,6 +36,7 @@ class_list=['Amoebozoa', 'Animalia', 'Bacteria', 'Bamfordvirae', 'Chromista', 'E
|
|
36 |
model1 = torch.load("model1.pt", map_location=torch.device('cpu'))
|
37 |
model2 = torch.load("model2.pt", map_location=torch.device('cpu'))
|
38 |
model3 = torch.load("model3.pt", map_location=torch.device('cpu'))
|
|
|
39 |
|
40 |
def fn(glycan, model):
|
41 |
# Draw graph
|
@@ -57,6 +58,9 @@ def fn(glycan, model):
|
|
57 |
elif model == "Ensemble":
|
58 |
model_pred = model3
|
59 |
model_pred.eval()
|
|
|
|
|
|
|
60 |
else:
|
61 |
model_pred = model2
|
62 |
model_pred.eval()
|
@@ -85,7 +89,7 @@ def fn(glycan, model):
|
|
85 |
|
86 |
demo = gr.Interface(
|
87 |
fn=fn,
|
88 |
-
inputs=[gr.Textbox(label="Glycan sequence"), gr.Radio(label="Model",choices=["No data augmentation", "Random node deletion", "Ensemble"])],
|
89 |
outputs=[gr.Label(num_top_classes=15, label="Prediction"), gr.Image(label="Glycan graph")],
|
90 |
allow_flagging="never",
|
91 |
title="SweetNet demo",
|
|
|
36 |
model1 = torch.load("model1.pt", map_location=torch.device('cpu'))
|
37 |
model2 = torch.load("model2.pt", map_location=torch.device('cpu'))
|
38 |
model3 = torch.load("model3.pt", map_location=torch.device('cpu'))
|
39 |
+
model4 = torch.load("model4.pt", map_location=torch.device('cpu'))
|
40 |
|
41 |
def fn(glycan, model):
|
42 |
# Draw graph
|
|
|
58 |
elif model == "Ensemble":
|
59 |
model_pred = model3
|
60 |
model_pred.eval()
|
61 |
+
elif model == "Bootstrap Ensemble":
|
62 |
+
model_pred = model4
|
63 |
+
model_pred.eval()
|
64 |
else:
|
65 |
model_pred = model2
|
66 |
model_pred.eval()
|
|
|
89 |
|
90 |
demo = gr.Interface(
|
91 |
fn=fn,
|
92 |
+
inputs=[gr.Textbox(label="Glycan sequence"), gr.Radio(label="Model",choices=["No data augmentation", "Random node deletion", "Ensemble", "Bootstrap Ensemble"])],
|
93 |
outputs=[gr.Label(num_top_classes=15, label="Prediction"), gr.Image(label="Glycan graph")],
|
94 |
allow_flagging="never",
|
95 |
title="SweetNet demo",
|