Spaces:
Build error
Build error
new gradio version check
Browse files- app.py +3 -9
- packages.txt +0 -3
app.py
CHANGED
@@ -1,13 +1,7 @@
|
|
1 |
-
import matplotlib
|
2 |
-
matplotlib.use('Agg')
|
3 |
-
|
4 |
-
import os
|
5 |
-
os.system('Xvfb :1 -screen 0 1600x1200x16 &') # create virtual display with size 1600x1200 and 16 bit color. Color can be changed to 24 or 8
|
6 |
-
os.environ['DISPLAY']=':1.0'
|
7 |
-
|
8 |
import gradio
|
9 |
import benepar
|
10 |
import spacy
|
|
|
11 |
import nltk
|
12 |
from nltk.tree import Tree
|
13 |
nltk.download('stopwords')
|
@@ -45,7 +39,7 @@ def predict(sentence, model):
|
|
45 |
elif model == "inside-outside":
|
46 |
best_parse = Predictor(sentence=sentence).obtain_best_parse(predict_type="inside_outside", model=inside_outside_model, scale_axis=1, predict_batch_size=128)
|
47 |
sentence_f1 = calculate_F1_for_spans(tree_to_spans(gold_standard), tree_to_spans(best_parse))
|
48 |
-
return
|
49 |
|
50 |
|
51 |
iface = gradio.Interface(
|
@@ -72,4 +66,4 @@ iface = gradio.Interface(
|
|
72 |
["Bitcoin community under pressure to cut energy use .", "inside"],
|
73 |
],
|
74 |
)
|
75 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio
|
2 |
import benepar
|
3 |
import spacy
|
4 |
+
from IPython.display import display
|
5 |
import nltk
|
6 |
from nltk.tree import Tree
|
7 |
nltk.download('stopwords')
|
|
|
39 |
elif model == "inside-outside":
|
40 |
best_parse = Predictor(sentence=sentence).obtain_best_parse(predict_type="inside_outside", model=inside_outside_model, scale_axis=1, predict_batch_size=128)
|
41 |
sentence_f1 = calculate_F1_for_spans(tree_to_spans(gold_standard), tree_to_spans(best_parse))
|
42 |
+
return gold_standard, best_parse, f"{sentence_f1:.2f}"
|
43 |
|
44 |
|
45 |
iface = gradio.Interface(
|
|
|
66 |
["Bitcoin community under pressure to cut energy use .", "inside"],
|
67 |
],
|
68 |
)
|
69 |
+
iface.launch(share=True)
|
packages.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
xvfb
|
2 |
-
ghostscript
|
3 |
-
python3-tk
|
|
|
|
|
|
|
|