Update app.py
Browse files
app.py
CHANGED
@@ -2,13 +2,54 @@ import streamlit as st
|
|
2 |
import time
|
3 |
import pandas as pd
|
4 |
import io
|
5 |
-
import
|
6 |
-
from gliner import GLiNER
|
7 |
from streamlit_extras.stylable_container import stylable_container
|
8 |
import plotly.express as px
|
|
|
|
|
|
|
9 |
import os
|
10 |
from comet_ml import Experiment
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
COMET_API_KEY = os.environ.get("COMET_API_KEY")
|
13 |
COMET_WORKSPACE = os.environ.get("COMET_WORKSPACE")
|
14 |
COMET_PROJECT_NAME = os.environ.get("COMET_PROJECT_NAME")
|
@@ -19,7 +60,17 @@ else:
|
|
19 |
comet_initialized = False
|
20 |
st.warning("Comet ML not initialized. Check environment variables.")
|
21 |
|
|
|
|
|
22 |
text = st.text_area("Type or paste your text below, and then press Ctrl + Enter", key='my_text_area')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
if st.button("Results"):
|
25 |
with st.spinner("Wait for it...", show_time=True):
|
|
|
2 |
import time
|
3 |
import pandas as pd
|
4 |
import io
|
5 |
+
from transformers import pipeline
|
|
|
6 |
from streamlit_extras.stylable_container import stylable_container
|
7 |
import plotly.express as px
|
8 |
+
import zipfile
|
9 |
+
from gliner import GLiNER
|
10 |
+
|
11 |
import os
|
12 |
from comet_ml import Experiment
|
13 |
|
14 |
+
|
15 |
+
|
16 |
+
st.subheader("8-Named Entity Recognition Web App", divider = "red")
|
17 |
+
st.link_button("DEMO APP by nlpblogs", "https://nlpblogs.com", type = "tertiary")
|
18 |
+
|
19 |
+
expander = st.expander("**Important notes on the 8-Named Entity Recognition Web App**")
|
20 |
+
expander.write('''
|
21 |
+
|
22 |
+
**Named Entities:**
|
23 |
+
This 8-Named Entity Recognition Web App predicts eight (8) labels (“person”, “country”, “city”, “organization”, “date”, “money”, “percent value”, “position”). Results are presented in an easy-to-read table, visualized in an interactive tree map, pie chart, and bar chart, and are available for download along with a Glossary of tags.
|
24 |
+
|
25 |
+
**How to Use:**
|
26 |
+
Type or paste your text and press Ctrl + Enter. Then, click the 'Results' button to extract and tag entities in your text data.
|
27 |
+
|
28 |
+
**Usage Limits:**
|
29 |
+
Unlimited number of Result requests.
|
30 |
+
|
31 |
+
**Customization:**
|
32 |
+
To change the app's background color to white or black, click the three-dot menu on the right-hand side of your app, go to Settings and then Choose app theme, colors and fonts.
|
33 |
+
|
34 |
+
**Technical issues:**
|
35 |
+
If your connection times out, please refresh the page or reopen the app's URL.
|
36 |
+
For any errors or inquiries, please contact us at [email protected]
|
37 |
+
|
38 |
+
''')
|
39 |
+
|
40 |
+
|
41 |
+
with st.sidebar:
|
42 |
+
container = st.container(border=True)
|
43 |
+
container.write("**Named Entity Recognition (NER)** is the task of extracting and tagging entities in text data. Entities can be persons, organizations, locations, countries, products, events etc.")
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
st.subheader("Related NLP Web Apps", divider = "red")
|
50 |
+
st.link_button("14-Named Entity Recognition Web App", "https://nlpblogs.com/shop/named-entity-recognition-ner/14-entity-ner-demo-app/", type = "primary")
|
51 |
+
|
52 |
+
|
53 |
COMET_API_KEY = os.environ.get("COMET_API_KEY")
|
54 |
COMET_WORKSPACE = os.environ.get("COMET_WORKSPACE")
|
55 |
COMET_PROJECT_NAME = os.environ.get("COMET_PROJECT_NAME")
|
|
|
60 |
comet_initialized = False
|
61 |
st.warning("Comet ML not initialized. Check environment variables.")
|
62 |
|
63 |
+
|
64 |
+
|
65 |
text = st.text_area("Type or paste your text below, and then press Ctrl + Enter", key='my_text_area')
|
66 |
+
st.write("**Input text**: ", text)
|
67 |
+
|
68 |
+
def clear_text():
|
69 |
+
st.session_state['my_text_area'] = ""
|
70 |
+
|
71 |
+
st.button("Clear text", on_click=clear_text)
|
72 |
+
|
73 |
+
st.divider()
|
74 |
|
75 |
if st.button("Results"):
|
76 |
with st.spinner("Wait for it...", show_time=True):
|