Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| examples=["This is wonderful movie!", "The movie was really bad; I didn't like it."] | |
| model_path = "waelChafei/bertuned" | |
| model = BertForSequenceClassification.from_pretrained(model_path) | |
| tokenizer= BertTokenizerFast.from_pretrained(model_path) | |
| nlp= pipeline("sentiment-analysis", model=model, tokenizer=tokenizer) | |
| def text_classification(text): | |
| result= classifier(text) | |
| return result | |
| io = gr.Interface(fn=text_classification, | |
| inputs= gr.Textbox(lines=2, label="Text", placeholder="Enter title here..."), | |
| outputs=gr.Textbox(lines=2, label="Text Classification Result"), | |
| title="Text Classification", | |
| description="Enter a text and see the text classification result!", | |
| examples=examples) | |
| io.launch() |