Spaces:
Sleeping
Sleeping
Add app.py
Browse files- README.md +1 -1
- app.py +24 -0
- requirements.txt +50 -0
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: 💻
|
|
4 |
colorFrom: gray
|
5 |
colorTo: purple
|
6 |
sdk: streamlit
|
7 |
-
sdk_version: 1.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
|
|
4 |
colorFrom: gray
|
5 |
colorTo: purple
|
6 |
sdk: streamlit
|
7 |
+
sdk_version: 1.19.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from st_ner_annotate import st_ner_annotate
|
3 |
+
|
4 |
+
st.title("Named entity recognition demo")
|
5 |
+
text = """Manhattan traces its origins to a trading post founded by colonists
|
6 |
+
from the Dutch Republic in 1624 on Lower Manhattan; the post was named New
|
7 |
+
Amsterdam in 1626. Manhattan is historically documented to have been purchased
|
8 |
+
by Dutch colonists from Native Americans in 1626 for 60 guilders, which equals
|
9 |
+
roughly $1059 in current terms. The territory and its surroundings came under
|
10 |
+
English control in 1664 and were renamed New York after King Charles II of
|
11 |
+
England granted the lands to his brother, the Duke of York. New York, based
|
12 |
+
in present-day Manhattan, served as the capital of the United States from 1785
|
13 |
+
until 1790. The Statue of Liberty greeted millions of immigrants as they came
|
14 |
+
to America by ship in the late 19th century and is a world symbol of the United
|
15 |
+
States and its ideals of liberty and peace. Manhattan became a borough during
|
16 |
+
the consolidation of New York City in 1898.
|
17 |
+
"""
|
18 |
+
|
19 |
+
entity_labels = ["LOC", "PERSON", "ORG", "MISC"]
|
20 |
+
ents = []
|
21 |
+
|
22 |
+
current_entity_type = st.selectbox("Mark for Entity Type", entity_labels)
|
23 |
+
entities = st_ner_annotate(current_entity_type, text, ents, key=42)
|
24 |
+
st.json(entities)
|
requirements.txt
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
altair==4.2.2
|
2 |
+
attrs==22.2.0
|
3 |
+
backports.zoneinfo==0.2.1
|
4 |
+
blinker==1.5
|
5 |
+
cachetools==5.3.0
|
6 |
+
certifi==2022.12.7
|
7 |
+
charset-normalizer==3.1.0
|
8 |
+
click==8.1.3
|
9 |
+
decorator==5.1.1
|
10 |
+
entrypoints==0.4
|
11 |
+
gitdb==4.0.10
|
12 |
+
GitPython==3.1.31
|
13 |
+
idna==3.4
|
14 |
+
importlib-metadata==6.1.0
|
15 |
+
importlib-resources==5.12.0
|
16 |
+
Jinja2==3.1.2
|
17 |
+
jsonschema==4.17.3
|
18 |
+
markdown-it-py==2.2.0
|
19 |
+
MarkupSafe==2.1.2
|
20 |
+
mdurl==0.1.2
|
21 |
+
numpy==1.24.2
|
22 |
+
packaging==23.0
|
23 |
+
pandas==1.5.3
|
24 |
+
Pillow==9.4.0
|
25 |
+
pkgutil_resolve_name==1.3.10
|
26 |
+
protobuf==3.20.3
|
27 |
+
pyarrow==11.0.0
|
28 |
+
pydeck==0.8.0
|
29 |
+
Pygments==2.14.0
|
30 |
+
Pympler==1.0.1
|
31 |
+
pyrsistent==0.19.3
|
32 |
+
python-dateutil==2.8.2
|
33 |
+
pytz==2023.2
|
34 |
+
pytz-deprecation-shim==0.1.0.post0
|
35 |
+
requests==2.28.2
|
36 |
+
rich==13.3.3
|
37 |
+
semver==2.13.0
|
38 |
+
six==1.16.0
|
39 |
+
smmap==5.0.0
|
40 |
+
st-ner-annotate==0.1.0
|
41 |
+
streamlit==1.20.0
|
42 |
+
toml==0.10.2
|
43 |
+
toolz==0.12.0
|
44 |
+
tornado==6.2
|
45 |
+
typing_extensions==4.5.0
|
46 |
+
tzdata==2023.2
|
47 |
+
tzlocal==4.3
|
48 |
+
urllib3==1.26.15
|
49 |
+
validators==0.20.0
|
50 |
+
zipp==3.15.0
|