File size: 453 Bytes
a9e1f9f a6b9dcc a9e1f9f 854dea4 a9e1f9f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import gradio as gr
from transformers import pipeline
# Load the fine-tuned model from Hugging Face Hub
classifier = pipeline("text-classification", model="Emanai/my-finetuned-bert2")
def classify_text(text):
result=classifier(text)
return '{} - {}'.format(result[0]['score'], result[0]['label'])
# Create a simple Gradio interface
iface = gr.Interface(fn=classify_text, inputs="text", outputs="label")
# Launch the Gradio app
iface.launch() |