Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,6 +13,7 @@
|
|
| 13 |
# print(f"Entity: {entity['word']}, Label: {entity['entity']}, Score: {entity['score']:.4f}")
|
| 14 |
# st.json(entity)
|
| 15 |
|
|
|
|
| 16 |
import streamlit as st
|
| 17 |
from transformers import pipeline
|
| 18 |
|
|
@@ -61,7 +62,9 @@ def merge_entities(entities):
|
|
| 61 |
return merged_entities
|
| 62 |
|
| 63 |
# Streamlit app to display entities
|
| 64 |
-
|
|
|
|
|
|
|
| 65 |
|
| 66 |
# Run NER model and merge results
|
| 67 |
if text:
|
|
@@ -70,5 +73,6 @@ if text:
|
|
| 70 |
|
| 71 |
# Display results
|
| 72 |
for entity in merged_results:
|
| 73 |
-
|
| 74 |
st.json(entity)
|
|
|
|
|
|
| 13 |
# print(f"Entity: {entity['word']}, Label: {entity['entity']}, Score: {entity['score']:.4f}")
|
| 14 |
# st.json(entity)
|
| 15 |
|
| 16 |
+
|
| 17 |
import streamlit as st
|
| 18 |
from transformers import pipeline
|
| 19 |
|
|
|
|
| 62 |
return merged_entities
|
| 63 |
|
| 64 |
# Streamlit app to display entities
|
| 65 |
+
st.title('Named Entity Recognition (NER) with Streamlit')
|
| 66 |
+
|
| 67 |
+
text = st.text_area('Enter text for NER analysis:')
|
| 68 |
|
| 69 |
# Run NER model and merge results
|
| 70 |
if text:
|
|
|
|
| 73 |
|
| 74 |
# Display results
|
| 75 |
for entity in merged_results:
|
| 76 |
+
st.write(f"Entity: {entity['word']}, Label: {entity['entity']}, Score: {entity['score']:.4f}")
|
| 77 |
st.json(entity)
|
| 78 |
+
|