Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,23 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
st.json(
|
|
|
|
| 1 |
+
# import streamlit as st
|
| 2 |
|
| 3 |
+
# from transformers import pipeline
|
| 4 |
+
|
| 5 |
+
# pipe = pipeline("text-classification", model="Beehzod/smart-finetuned-ner")
|
| 6 |
+
|
| 7 |
+
# text = st.text_area('enter text: ')
|
| 8 |
+
|
| 9 |
+
# if text:
|
| 10 |
+
# out = pipe(text)
|
| 11 |
+
# st.json(out)
|
| 12 |
from transformers import pipeline
|
| 13 |
|
| 14 |
+
# Load the model from the Hugging Face Hub
|
| 15 |
+
ner_pipeline = pipeline("ner", model="Beehzod/smart-finetuned-ner")
|
| 16 |
|
| 17 |
+
# Example predictions
|
| 18 |
+
text = "Hugging Face Inc. is based in New York City, and its CEO is Clement Delangue."
|
| 19 |
+
results = ner_pipeline(text)
|
| 20 |
|
| 21 |
+
for entity in results:
|
| 22 |
+
#print(f"Entity: {entity['word']}, Label: {entity['entity']}, Score: {entity['score']:.4f}")
|
| 23 |
+
st.json(entity)
|