Murat62 commited on
Commit
2458217
1 Parent(s): 57c0c0a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
3
+
4
+ model = AutoModelForSequenceClassification.from_pretrained("savasy/bert-base-turkish-sentiment-cased")
5
+ tokenizer = AutoTokenizer.from_pretrained("savasy/bert-base-turkish-sentiment-cased")
6
+
7
+ def greet(text):
8
+ pipe = pipeline("sentiment-analysis", tokenizer=tokenizer, model=model)
9
+ return pipe(text)[0]['label']
10
+
11
+ iface = gr.Interface(fn=greet, inputs=gr.inputs.Textbox(placeholder="Lütfen Cümle Giriniz...", lines=5), outputs="text")
12
+ iface.launch()