Spaces:
Runtime error
Runtime error
Commit
β’
555c9ce
1
Parent(s):
17cc556
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()
|