It seems that when the line test=model.predict([text]) is executed, your entire project runs six times consecutively, and when you close the opened windows, it makes predictions.
You can see the code snippets below.
[main file]
print("test1")
def classification():
print("test2")
raw_text = str(entry.get("1.0", tk.END))
tahmin_sonucu = main(raw_text)
categories_label.config(text="Kategoriler: " + tahmin_sonucu)
[main function]
from simpletransformers.classification import ClassificationModel
labels = ["Bilim Kurgu", "Ekonomi", "İslam", "Polisiye", "Romantik", "Sağlık", "Spor"]
model = ClassificationModel('bert', 'bert_model', num_labels=7, use_cuda=False,
args={'reprocess_input_data': True, 'overwrite_output_dir': True, 'num_train_epochs': 3,
"train_batch_size": 16, "fp16": False, "output_dir": "bert_model"})
print("test11")
def main(metin):
tahmin = None
print("tes12")
tahmin=model.predict([metin])
print(labels[tahmin[0][0]])
return labels[tahmin[0][0]]
Outbut
New contributor
MecitŞebib is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.