Spaces:
Runtime error
Runtime error
ben-epstein
commited on
Commit
•
fe9bafb
1
Parent(s):
4bad7b8
make spacy-en model a part of requirements for demo
Browse files- app.py +7 -15
- requirements.txt +2 -1
app.py
CHANGED
@@ -1,27 +1,19 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
from spacy_to_hf import spacy_to_hf
|
3 |
-
import os
|
4 |
-
import spacy
|
5 |
-
from datasets import Dataset
|
6 |
import json
|
7 |
from json import JSONDecodeError
|
8 |
|
|
|
|
|
9 |
|
10 |
-
|
11 |
-
nlp = spacy.load("en_core_web_sm")
|
12 |
-
except:
|
13 |
-
os.system("python -m spacy download en_core_web_sm")
|
14 |
-
st.experimental_rerun()
|
15 |
-
|
16 |
|
17 |
demo_option = [
|
18 |
{
|
19 |
"text": "Planned to go to the Apple Storefront on Tuesday",
|
20 |
"spans": [
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
}
|
26 |
]
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import json
|
2 |
from json import JSONDecodeError
|
3 |
|
4 |
+
import streamlit as st
|
5 |
+
from datasets import Dataset
|
6 |
|
7 |
+
from spacy_to_hf import spacy_to_hf
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
demo_option = [
|
10 |
{
|
11 |
"text": "Planned to go to the Apple Storefront on Tuesday",
|
12 |
"spans": [
|
13 |
+
{"start": 0, "end": 7, "label": "Action"},
|
14 |
+
{"start": 21, "end": 37, "label": "Loc"},
|
15 |
+
{"start": 41, "end": 48, "label": "Date"},
|
16 |
+
],
|
17 |
}
|
18 |
]
|
19 |
|
requirements.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
streamlit
|
2 |
spacy-to-hf
|
3 |
-
datasets
|
|
|
|
1 |
streamlit
|
2 |
spacy-to-hf
|
3 |
+
datasets
|
4 |
+
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz#egg=en_core_web_sm
|