savasy commited on
Commit
95b1e54
1 Parent(s): 9acf6b4

create first space app

Browse files
Files changed (1) hide show
  1. app.py +13 -0
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()