Spaces:
Sleeping
Sleeping
Create app.py
Browse files
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()
|