File size: 565 Bytes
52f086b
 
 
d943537
 
52f086b
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import gradio as gr
from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline

model = AutoModelForSequenceClassification.from_pretrained("savasy/bert-base-turkish-sentiment-cased")
tokenizer = AutoTokenizer.from_pretrained("savasy/bert-base-turkish-sentiment-cased")

def greet(text):
    pipe = pipeline("sentiment-analysis", tokenizer=tokenizer, model=model)
    return pipe(text)[0]['label']
    
iface = gr.Interface(fn=greet, inputs=gr.inputs.Textbox(placeholder="Lütfen Cümle Giriniz...", lines=5), outputs="text")
iface.launch()