ruanchaves commited on
Commit
fa5ff01
1 Parent(s): 69f0559
Files changed (1) hide show
  1. app.py +15 -6
app.py CHANGED
@@ -39,6 +39,12 @@ displaying the relationship between the text pairs.
39
  exibindo a relação entre os pares textuais.)
40
  """ }
41
 
 
 
 
 
 
 
42
  score_descriptions = {
43
  1: "There is an entailment relation between premise and hypothesis. If the premise is true, then the hypothesis must also be true.",
44
  0: "There is no logical relation between the premise and the hypothesis.",
@@ -116,19 +122,22 @@ def predict(s1, s2, chosen_model):
116
  final_description = description + "\n \n" + description_pt
117
  return final_description
118
 
119
- scores = { get_description(k):v for k,v in enumerate(logits) }
 
 
120
 
121
- return scores
122
 
123
 
124
  inputs = [
125
- gr.inputs.Textbox(label="Premise"),
126
- gr.inputs.Textbox(label="Hypothesis"),
127
- gr.Dropdown(label="Model", choices=user_friendly_name_list, default=user_friendly_name_list[0])
128
  ]
129
 
130
  outputs = [
131
- gr.Label(label="Result")
 
132
  ]
133
 
134
 
 
39
  exibindo a relação entre os pares textuais.)
40
  """ }
41
 
42
+ short_score_descriptions = {
43
+ 1: "Entailment (Implicação)",
44
+ 0: "No relationship (Nenhuma relação)",
45
+ 2: "Paraphrase (Paráfrase)"
46
+ }
47
+
48
  score_descriptions = {
49
  1: "There is an entailment relation between premise and hypothesis. If the premise is true, then the hypothesis must also be true.",
50
  0: "There is no logical relation between the premise and the hypothesis.",
 
122
  final_description = description + "\n \n" + description_pt
123
  return final_description
124
 
125
+ max_pos = logits.index(max(logits))
126
+ description = get_description(max_pos)
127
+ scores = { short_score_descriptions[k]:v for k,v in enumerate(logits) }
128
 
129
+ return scores, description
130
 
131
 
132
  inputs = [
133
+ gr.Textbox(label="Premise", value=app_examples[0][0]),
134
+ gr.Textbox(label="Hypothesis", value=app_examples[0][1]),
135
+ gr.Dropdown(label="Model", choices=user_friendly_name_list, value=user_friendly_name_list[0])
136
  ]
137
 
138
  outputs = [
139
+ gr.Label(label="Result"),
140
+ gr.Markdown()
141
  ]
142
 
143