lorenzoscottb commited on
Commit
f620641
·
1 Parent(s): af9ef3e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -10,15 +10,31 @@ data = pd.DataFrame(
10
 
11
  adjs = set(data["Adj"])
12
  Nns = set(list(data["Nn"]) + list(data["Hypr"]))
 
13
 
 
 
 
 
 
 
 
 
 
 
14
  description = "Did you know that, logically speaking, a small cat is not a small animal, and that a fake smile is not a smile. \n Learn more testing our BERT model is tuned to perform phrase-level adjective-noun entailment, via the [PLANE](https://aclanthology.org/2022.coling-1.359/) dataset. \n The current model achieves an accuracy of 90% on out-of-distribution evaluation"
15
  title = "BERT on a PLANE"
16
  examples = [["A red car is a vehicle"], ["A fake smile is a smile"], ["A small cat is a small animal"]]
17
 
18
- interface = gr.Interface.load("huggingface/lorenzoscottb/bert-base-cased-PLANE-ood-2",
19
  description=description,
20
  examples=examples,
21
  title=title,
22
  )
23
 
24
- interface.launch()
 
 
 
 
 
 
10
 
11
  adjs = set(data["Adj"])
12
  Nns = set(list(data["Nn"]) + list(data["Hypr"]))
13
+ all_set = set(list(adjs) + list(Nns))
14
 
15
+ def test_input(words):
16
+ words = list(words)
17
+ word_dict = {}
18
+ for w in words:
19
+ if w in all_set:
20
+ word_dict[w] = "in-distribution"
21
+ else:
22
+ word_dict[w] = "out-of-distribution"
23
+ return word_dict
24
+
25
  description = "Did you know that, logically speaking, a small cat is not a small animal, and that a fake smile is not a smile. \n Learn more testing our BERT model is tuned to perform phrase-level adjective-noun entailment, via the [PLANE](https://aclanthology.org/2022.coling-1.359/) dataset. \n The current model achieves an accuracy of 90% on out-of-distribution evaluation"
26
  title = "BERT on a PLANE"
27
  examples = [["A red car is a vehicle"], ["A fake smile is a smile"], ["A small cat is a small animal"]]
28
 
29
+ interface_model = gr.Interface.load("huggingface/lorenzoscottb/bert-base-cased-PLANE-ood-2",
30
  description=description,
31
  examples=examples,
32
  title=title,
33
  )
34
 
35
+ # interface.launch()
36
+
37
+
38
+ Series(
39
+ interface_model
40
+ ).launch()