Update app.py
Browse files
app.py
CHANGED
|
@@ -12,7 +12,7 @@ try:
|
|
| 12 |
except ImportError:
|
| 13 |
os.system('pip install toml')
|
| 14 |
import toml
|
| 15 |
-
|
| 16 |
model = GraphormerForGraphClassification.from_pretrained("PedroLancharesSanchez/graph-regression")
|
| 17 |
|
| 18 |
def predict(instancia):
|
|
@@ -32,12 +32,6 @@ def predict(instancia):
|
|
| 32 |
logits = model(**inputs).logits
|
| 33 |
return str(logits.item())
|
| 34 |
|
| 35 |
-
ejemplos = '''{"node_feat": [[0],[0],[0],[0],[0],[0],[0],[0],[1],[0],[0],[0],[0],[1],[2],[0],[0],[0],[0],[0],[0],[3],[0],[0]],
|
| 36 |
-
"edge_index": [[0,1,1,1,1,2,3,4,4,4,5,5,6,6,7,7,7,8,8,9,9,10,10,10,11,11,12,12,12,13,14,14,15,15,15,16,16,17,17,18,18,19,19,20,20,20,21,22,22,22,23,23]],
|
| 37 |
-
"edge_attr": [[1],[1],[1],[1],[1],[1],[1],[1],[2],[1],[2],[1],[1],[2],[2],[1],[1],[1],[1],[1],[2],[2],[1],[1],[1],[1],[1],[2],[1],[2],[1],[1],[1],[2],[1],[2],[1],[1],[2],[2],[1],[1],[2],[1],[2],[1],[1],[1],[1],[2],[1],[2]],
|
| 38 |
-
"y": [3.1381945610046387],
|
| 39 |
-
"num_nodes": 24}'''
|
| 40 |
-
|
| 41 |
# Crear la interfaz Gradio
|
| 42 |
-
interfaz = gr.Interface(fn=predict, inputs="file", outputs='text', examples=['grafo1.json'])
|
| 43 |
interfaz.launch(share=False)
|
|
|
|
| 12 |
except ImportError:
|
| 13 |
os.system('pip install toml')
|
| 14 |
import toml
|
| 15 |
+
|
| 16 |
model = GraphormerForGraphClassification.from_pretrained("PedroLancharesSanchez/graph-regression")
|
| 17 |
|
| 18 |
def predict(instancia):
|
|
|
|
| 32 |
logits = model(**inputs).logits
|
| 33 |
return str(logits.item())
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
# Crear la interfaz Gradio
|
| 36 |
+
interfaz = gr.Interface(fn=predict, inputs="file", outputs='text', examples=['grafo1.json','grafo2.json','grafo3.json'])
|
| 37 |
interfaz.launch(share=False)
|