final-project / app.py
kylezhao101's picture
import knowledge_extraction model
0f51a7f
raw
history blame
624 Bytes
import streamlit as st
from transformers import pipeline
# Load the token classification pipeline
model_name = "jjzha/jobbert_knowledge_extraction"
pipe = pipeline("token-classification", model=model_name)
# Streamlit UI
st.title("Token Classification with Hugging Face")
text_input = st.text_area("Enter text for token classification:")
if text_input:
# Perform token classification
results = pipe(text_input)
# Display the results
st.write("Token Classification Results:")
for result in results:
st.write(f"Entity: {result['entity']}, Word: {result['word']}, Score: {result['score']:.2f}")