File size: 624 Bytes
6759ca3
0f51a7f
6137008
0f51a7f
 
 
6759ca3
 
0f51a7f
 
6759ca3
 
0f51a7f
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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}")