dalexanderch commited on
Commit
47aa6b1
1 Parent(s): fc829e4

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -46,6 +46,7 @@ def fn(glycan, model):
46
  glycan = [glycan]
47
  label = [0]
48
  data = next(iter(dataset_to_dataloader(glycan, label, batch_size=1)))
 
49
  if model == "Ensemble":
50
  pred = model_pred(data)
51
  else:
@@ -57,6 +58,7 @@ def fn(glycan, model):
57
  edge_index = edge_index.to(device)
58
  batch = batch.to(device)
59
  pred = model_pred(x,edge_index, batch).cpu().detach().numpy()[0]
 
60
  pred = np.exp(pred)/sum(np.exp(pred)) # Softmax
61
  pred = [float(x) for x in pred]
62
  pred = {class_list[i]:pred[i] for i in range(15)}
@@ -65,7 +67,7 @@ def fn(glycan, model):
65
 
66
  demo = gr.Interface(
67
  fn=fn,
68
- inputs=[gr.Textbox(label="Glycan sequence"), gr.Radio(label="Model",choices=["No data augmentation", "Random node deletion"])],
69
  outputs=[gr.Label(num_top_classes=15, label="Prediction")],
70
  allow_flagging=False,
71
  title="SweetNet demo",
 
46
  glycan = [glycan]
47
  label = [0]
48
  data = next(iter(dataset_to_dataloader(glycan, label, batch_size=1)))
49
+
50
  if model == "Ensemble":
51
  pred = model_pred(data)
52
  else:
 
58
  edge_index = edge_index.to(device)
59
  batch = batch.to(device)
60
  pred = model_pred(x,edge_index, batch).cpu().detach().numpy()[0]
61
+
62
  pred = np.exp(pred)/sum(np.exp(pred)) # Softmax
63
  pred = [float(x) for x in pred]
64
  pred = {class_list[i]:pred[i] for i in range(15)}
 
67
 
68
  demo = gr.Interface(
69
  fn=fn,
70
+ inputs=[gr.Textbox(label="Glycan sequence"), gr.Radio(label="Model",choices=["No data augmentation", "Random node deletion", "Ensemble"])],
71
  outputs=[gr.Label(num_top_classes=15, label="Prediction")],
72
  allow_flagging=False,
73
  title="SweetNet demo",