marcelcastrobr commited on
Commit
dab52d1
1 Parent(s): cf4494f

update of application

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -8,10 +8,14 @@ def sequence_to_classify(sequence, labels):
8
  #candidate_labels = ['politikk', 'helse', 'sport', 'religion']
9
  hypothesis_template = 'Dette eksempelet er {}.'
10
  #classifier(sequence_to_classify, candidate_labels, hypothesis_template=hypothesis_template, multi_class=True)
11
- return classifier(sequence, labels, hypothesis_template=hypothesis_template, multi_class=True)
12
-
13
-
14
 
 
 
 
 
15
 
16
  def greet(name):
17
  return "Hello " + name + "!!"
@@ -26,10 +30,10 @@ iface = gr.Interface(
26
  gr.inputs.Textbox(lines=2,
27
  label="Possible candidate labels",
28
  placeholder="labels here...")],
29
- outputs=gr.outputs.Label(num_top_classes=3),
30
  capture_session=True,
31
  interpretation="default"
32
  ,examples=[
33
- [('Folkehelseinstituttets mest optimistiske anslag er at alle voksne er ferdigvaksinert innen midten av september.'), ('politikk', 'helse', 'sport', 'religion')]
34
  ])
35
  iface.launch()
8
  #candidate_labels = ['politikk', 'helse', 'sport', 'religion']
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
17
+ ferdigvaksinert innen midten av september.'"""
18
+ example_labels=['politikk', 'helse', 'sport', 'religion']
19
 
20
  def greet(name):
21
  return "Hello " + name + "!!"
30
  gr.inputs.Textbox(lines=2,
31
  label="Possible candidate labels",
32
  placeholder="labels here...")],
33
+ outputs=gr.outputs.Label(num_top_classes=3, label="Categories"),
34
  capture_session=True,
35
  interpretation="default"
36
  ,examples=[
37
+ [example_text, example_labels]
38
  ])
39
  iface.launch()