Spaces:
Runtime error
Runtime error
create first space app
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
4 |
+
|
5 |
+
tokenizer = AutoTokenizer.from_pretrained("savasy/bert-turkish-text-classification")
|
6 |
+
model = AutoModelForSequenceClassification.from_pretrained("savasy/bert-turkish-text-classification")
|
7 |
+
|
8 |
+
|
9 |
+
def classify(text):
|
10 |
+
cls= pipeline("text-classification",model=model, tokenizer=tokenizer)
|
11 |
+
return cls(text)[0]['label']
|
12 |
+
|
13 |
+
gr.Interface(fn=classify, inputs=["textbox"], outputs="label").launch()
|