test / app.py
Emanai's picture
Update app.py
a6b9dcc verified
raw
history blame
495 Bytes
import gradio as gr
from transformers import pipeline
from transformers import AutoTokenizer
# Load the fine-tuned model from Hugging Face Hub
classifier = pipeline("text-classification", model="Emanai/my-finetuned-bert2")
tokenizer = AutoTokenizer.from_pretrained('Emanai/my-finetuned-bert2')
def classify_text(text):
return classifier(text)
# Create a simple Gradio interface
iface = gr.Interface(fn=classify_text, inputs="text", outputs="label")
# Launch the Gradio app
iface.launch()