Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| # Load the spam classifier model | |
| classifier = pipeline("text-classification", model="skandavivek2/spam-classifier") | |
| def spam_detector(text): | |
| result = classifier(text) | |
| return "Spam" if result[0]['label'] == 'spam' else "Not Spam" | |
| # Create Gradio UI | |
| app = gr.Interface( | |
| fn=spam_detector, | |
| inputs=gr.Textbox(label="Enter a message"), | |
| outputs=gr.Textbox(label="Prediction"), | |
| title="Spam Detector", | |
| description="Enter a message to check if it's spam or not." | |
| ) | |
| # Run the app | |
| if __name__ == "__main__": | |
| app.launch() |