sotosbarl commited on
Commit
bb86df1
·
1 Parent(s): f526817

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -13
app.py CHANGED
@@ -10,22 +10,18 @@ device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cp
10
 
11
  classifier = pipeline("zero-shot-classification", model="MoritzLaurer/mDeBERTa-v3-base-mnli-xnli")
12
 
13
- with open('chapter_titles.pkl', 'rb') as file:
14
- titles_astiko = pickle.load(file)
15
-
 
16
 
17
  # titles_astiko = ["γάμος", "αλλοδαπός", "φορολογία", "κληρονομικά", "στέγη", "οικογενειακό", "εμπορικό","κλοπή","απάτη"]
18
 
19
 
20
  def classify(text):
21
- output = classifier(text, titles_astiko, multi_label=True)
22
- labels = output['labels']
23
- scores = output['scores']
24
- return_labels = []
25
- st.text(scores)
26
-
27
- st.text(len(scores))
28
- st.text(len(labels))
29
 
30
  # for i in range(len(scores)):
31
  # if scores[i] > 0.99:
@@ -34,9 +30,12 @@ def classify(text):
34
  # break
35
  # # output = output[0:10]
36
  # return return_labels
37
- return labels[0:20]
38
 
39
 
40
  text = st.text_input('Enter some text:') # Input field for new text
41
  if text:
42
- st.text(classify(text))
 
 
 
 
10
 
11
  classifier = pipeline("zero-shot-classification", model="MoritzLaurer/mDeBERTa-v3-base-mnli-xnli")
12
 
13
+ # with open('chapter_titles.pkl', 'rb') as file:
14
+ # titles_astiko = pickle.load(file)
15
+ labels1 = ["κληρονομικό", "εμπορικό", "διαζύγιο"]
16
+ labels2 = ["αποδοχή κληρονομιάς", "κληρονόμοι", "ιδιόγραφη διαθήκη"]
17
 
18
  # titles_astiko = ["γάμος", "αλλοδαπός", "φορολογία", "κληρονομικά", "στέγη", "οικογενειακό", "εμπορικό","κλοπή","απάτη"]
19
 
20
 
21
  def classify(text):
22
+ output = classifier(text, labels1, multi_label=False)
23
+ output2 = classifier(text, labels2, multi_label=False)
24
+
 
 
 
 
 
25
 
26
  # for i in range(len(scores)):
27
  # if scores[i] > 0.99:
 
30
  # break
31
  # # output = output[0:10]
32
  # return return_labels
33
+ return output, output2
34
 
35
 
36
  text = st.text_input('Enter some text:') # Input field for new text
37
  if text:
38
+ output1 = classify(text)
39
+ output2 = classify(text)
40
+ st.text(output1)
41
+ st.text(output1)