File size: 518 Bytes
95b1e54
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import gradio as gr
from transformers import pipeline
from transformers import AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("savasy/bert-turkish-text-classification")
model = AutoModelForSequenceClassification.from_pretrained("savasy/bert-turkish-text-classification")


def classify(text):
    cls= pipeline("text-classification",model=model, tokenizer=tokenizer)
    return cls(text)[0]['label']

gr.Interface(fn=classify, inputs=["textbox"], outputs="label").launch()