Update app.py
Browse files
app.py
CHANGED
@@ -12,34 +12,35 @@ classifier = pipeline("zero-shot-classification", model="MoritzLaurer/mDeBERTa-v
|
|
12 |
|
13 |
# with open('chapter_titles.pkl', 'rb') as file:
|
14 |
# titles_astiko = pickle.load(file)
|
15 |
-
labels1 = ["κληρονομικό", "ακίνητα", "διαζύγιο"]
|
16 |
-
labels2 = ["αποδοχή κληρονομιάς", "αποποίηση", "διαθήκη"]
|
17 |
-
labels3 = ["μίσθωση", "κυριότητα", "έξωση", "απλήρωτα νοίκια"]
|
18 |
-
|
19 |
|
20 |
|
21 |
# titles_astiko = ["γάμος", "αλλοδαπός", "φορολογία", "κληρονομικά", "στέγη", "οικογενειακό", "εμπορικό","κλοπή","απάτη"]
|
|
|
|
|
|
|
22 |
|
23 |
-
|
24 |
-
def classify(text):
|
25 |
output = classifier(text, labels1, multi_label=False)
|
26 |
-
output2 = classifier(text, labels2, multi_label=False)
|
27 |
-
output3 = classifier(text, labels3, multi_label=False)
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
# if scores[i] > 0.99:
|
32 |
-
# return_labels.append(labels[i])
|
33 |
-
# else:
|
34 |
-
# break
|
35 |
-
# # output = output[0:10]
|
36 |
-
# return return_labels
|
37 |
-
return output, output2, output3
|
38 |
|
39 |
|
40 |
text = st.text_input('Enter some text:') # Input field for new text
|
|
|
41 |
if text:
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# with open('chapter_titles.pkl', 'rb') as file:
|
14 |
# titles_astiko = pickle.load(file)
|
15 |
+
# labels1 = ["κληρονομικό", "ακίνητα", "διαζύγιο"]
|
16 |
+
# labels2 = ["αποδοχή κληρονομιάς", "αποποίηση", "διαθήκη"]
|
17 |
+
# labels3 = ["μίσθωση", "κυριότητα", "έξωση", "απλήρωτα νοίκια"]
|
|
|
18 |
|
19 |
|
20 |
# titles_astiko = ["γάμος", "αλλοδαπός", "φορολογία", "κληρονομικά", "στέγη", "οικογενειακό", "εμπορικό","κλοπή","απάτη"]
|
21 |
+
# Load dictionary from the file using pickle
|
22 |
+
with open('my_dict.pickle', 'rb') as file:
|
23 |
+
dictionary = pickle.load(file)
|
24 |
|
25 |
+
def classify(text,labels):
|
|
|
26 |
output = classifier(text, labels1, multi_label=False)
|
|
|
|
|
|
|
27 |
|
28 |
+
return output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
|
31 |
text = st.text_input('Enter some text:') # Input field for new text
|
32 |
+
|
33 |
if text:
|
34 |
+
|
35 |
+
labels = list(dictionary)
|
36 |
+
|
37 |
+
output = classify(text,labels)
|
38 |
+
|
39 |
+
labels = list(dictionary[output])
|
40 |
+
|
41 |
+
output2 = classify(text,labels)
|
42 |
+
|
43 |
+
answer = dictionary[output][output2]
|
44 |
+
|
45 |
+
st.text(answer)
|
46 |
+
|