Spaces:
Runtime error
Runtime error
dalexanderch
commited on
Commit
•
f73e099
1
Parent(s):
cc4e3d8
Upload app.py
Browse files
app.py
CHANGED
@@ -10,9 +10,9 @@ import numpy as np
|
|
10 |
import torch
|
11 |
import torch.nn as nn
|
12 |
from networkx.drawing.nx_agraph import write_dot
|
13 |
-
import pygraphviz as pgv
|
14 |
-
from glycowork.motif.graph import glycan_to_nxGraph
|
15 |
-
import networkx as nx
|
16 |
|
17 |
class EnsembleModel(nn.Module):
|
18 |
def __init__(self, models):
|
@@ -41,14 +41,14 @@ model3 = torch.load("model3.pt", map_location=torch.device('cpu'))
|
|
41 |
|
42 |
def fn(glycan, model):
|
43 |
# Draw graph
|
44 |
-
graph = glycan_to_nxGraph(glycan)
|
45 |
-
node_labels = nx.get_node_attributes(graph, 'string_labels')
|
46 |
-
labels = {i:node_labels[i] for i in range(len(graph.nodes))}
|
47 |
-
graph = nx.relabel_nodes(graph, labels)
|
48 |
-
write_dot(graph, "graph.dot")
|
49 |
-
graph=pgv.AGraph("graph.dot")
|
50 |
-
graph.layout(prog='dot')
|
51 |
-
graph.draw("graph.png")
|
52 |
|
53 |
# Perform inference
|
54 |
if model == "No data augmentation":
|
|
|
10 |
import torch
|
11 |
import torch.nn as nn
|
12 |
from networkx.drawing.nx_agraph import write_dot
|
13 |
+
# import pygraphviz as pgv
|
14 |
+
# from glycowork.motif.graph import glycan_to_nxGraph
|
15 |
+
# import networkx as nx
|
16 |
|
17 |
class EnsembleModel(nn.Module):
|
18 |
def __init__(self, models):
|
|
|
41 |
|
42 |
def fn(glycan, model):
|
43 |
# Draw graph
|
44 |
+
# graph = glycan_to_nxGraph(glycan)
|
45 |
+
# node_labels = nx.get_node_attributes(graph, 'string_labels')
|
46 |
+
# labels = {i:node_labels[i] for i in range(len(graph.nodes))}
|
47 |
+
# graph = nx.relabel_nodes(graph, labels)
|
48 |
+
# write_dot(graph, "graph.dot")
|
49 |
+
# graph=pgv.AGraph("graph.dot")
|
50 |
+
# graph.layout(prog='dot')
|
51 |
+
# graph.draw("graph.png")
|
52 |
|
53 |
# Perform inference
|
54 |
if model == "No data augmentation":
|