Spaces:
Runtime error
Runtime error
import streamlit as st | |
from transformers import pipeline | |
# Load the text classification model for spam detection | |
classifier = pipeline("text-classification", model="mrm8488/bert-tiny-finetuned-sms-spam-detection") | |
def main(): | |
st.title("Spam Detection App") | |
# Text input for the user to enter a message | |
user_input = st.text_input("Enter a message:") | |
if st.button("Check for Spam"): | |
if user_input: | |
# Use the loaded model to classify the user's input | |
result = classifier(user_input)[0] | |
# Display the result | |
st.write(f"**Result:** {result['label']} (Confidence: {result['score']:.2%})") | |
if __name__ == "__main__": | |
main() | |