Spaces:
Sleeping
Sleeping
| # import gradio as gr | |
| # def greet(name): | |
| # return "Hello " + name + "!!" | |
| # demo = gr.Interface(fn=greet, inputs="text", outputs="text") | |
| # demo.launch() | |
| import gradio as gr | |
| from transformers import pipeline | |
| # Load model from Hugging Face Hub | |
| classifier = pipeline("text-classification", model="Mhammad2023/bert-finetuned-ner") | |
| def predict(text): | |
| result = classifier(text)[0] | |
| return f"{result['label']} ({round(result['score']*100, 2)}%)" | |
| gr.Interface(fn=predict, inputs="text", outputs="text", title="Text Classification").launch() | |