File size: 904 Bytes
12ba4ff 52f43c9 0dc3afb 52f43c9 805f6fe 52f43c9 46cd5e7 d9d80a0 bedfda3 805f6fe 52f43c9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
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")
# model_name = "MoritzLaurer/mDeBERTa-v3-base-mnli-xnli"
# tokenizer = AutoTokenizer.from_pretrained(model_name)
# model = AutoModelForSequenceClassification.from_pretrained(model_name)
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:') # Input field for new text
if text:
st.text(classify(text)) |