marcelcastrobr commited on
Commit
22aedd0
1 Parent(s): dab52d1

update of application

Browse files
Files changed (2) hide show
  1. app.py +4 -2
  2. test.json +3 -0
app.py CHANGED
@@ -9,8 +9,10 @@ def sequence_to_classify(sequence, labels):
9
  hypothesis_template = 'Dette eksempelet er {}.'
10
  #classifier(sequence_to_classify, candidate_labels, hypothesis_template=hypothesis_template, multi_class=True)
11
  response = classifier(sequence, labels, hypothesis_template=hypothesis_template, multi_class=True)
12
- print(response)
13
- return response
 
 
14
 
15
  example_text="""
16
  Folkehelseinstituttets mest optimistiske anslag er at alle voksne er
9
  hypothesis_template = 'Dette eksempelet er {}.'
10
  #classifier(sequence_to_classify, candidate_labels, hypothesis_template=hypothesis_template, multi_class=True)
11
  response = classifier(sequence, labels, hypothesis_template=hypothesis_template, multi_class=True)
12
+ clean_output = {labels[idx]: str(respose['scores'].pop(1)) for idx in response['labels']}
13
+ print("response is:{}".format(response))
14
+ print("clean_output: {}".format(clean_output))
15
+ return clean_output
16
 
17
  example_text="""
18
  Folkehelseinstituttets mest optimistiske anslag er at alle voksne er
test.json ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ { 'sequence': "\nFolkehelseinstituttets mest optimistiske anslag er at alle voksne er \nferdigvaksinert innen midten av september.'",
2
+ 'labels': ['helse', 'politikk', 'religion', 'sport'],
3
+ 'scores': [0.7680550217628479, 0.21670468151569366, 0.01563994586467743, 0.00441053556278348] }