Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| # Initialize the pipeline | |
| classifier = pipeline('text-classification', model='Dc-4nderson/cic-checkin-relevance-classifier') | |
| def predict(text): | |
| result = classifier(text) | |
| # result looks like: [{'label': 'relevant', 'score': 0.95}] | |
| return result[0] | |
| # Create the Gradio interface | |
| demo = gr.Interface( | |
| fn=predict, | |
| inputs=gr.Textbox(label="Enter text to classify"), | |
| outputs=gr.JSON(label="Classification Result"), | |
| title="CIC Check-in Relevance Classifier" | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() |