|
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline |
|
import torch |
|
import pickle |
|
import streamlit as st |
|
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu") |
|
|
|
|
|
|
|
|
|
|
|
classifier = pipeline("zero-shot-classification", model="MoritzLaurer/mDeBERTa-v3-base-mnli-xnli") |
|
|
|
|
|
|
|
label_names = ["γάμος", "αλλοδαπός", "φορολογία", "κληρονομικά", "στέγη", "οικογενειακό", "εμπορικό","κλοπή","απάτη"] |
|
|
|
|
|
def classify(text): |
|
output = classifier(text, label_names, multi_label=True) |
|
return output |
|
|
|
|
|
text = st.text_input('Enter some text:') |
|
if text: |
|
st.text(classify(text)) |