import streamlit as st from transformers import pipeline model = pipeline('text-classification', model='distilbert-base-uncased') def app(): # Set the title of the app st.title("Text Classification with Huggingface") # Get user input user_input = st.text_input("Enter some text") # Classify the text using the Huggingface model if user_input: result = model(user_input)[0] label = result['label'] score = result['score'] # Display the result st.write(f"Label: {label}") st.write(f"Score: {score}") if __name__ == "__main__": app()