Last active
February 27, 2022 14:10
-
-
Save alperbayram/00c6b7d4b202656f026299ab4910d9a3 to your computer and use it in GitHub Desktop.
app.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment