publichealthsurveillance commited on
Commit
d21c450
1 Parent(s): 84e4411

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -5
app.py CHANGED
@@ -5,8 +5,8 @@ vs_examples = [
5
  ["I only get my kids the ones I got....I've turned down many so called 'vaccines'"],
6
  ["In child protective services, further providing for definitions, for immunity from liability"],
7
  ["Lol what? Measles is a real thing. Get vaccinated"]]
8
- vs_title = "Vaccine Sentiment Task - VS2"
9
- vs_desc = "Enter vaccine-related tweets to generate sentiment from 3 models (BERT, MentalBERT, PHS-BERT). Label 0='vaccine critical', 1='neutral', 2='vaccine supportive'. The three provided examples have true labels 0,1,2 respectively. For details about VS2, please refer to our paper (linked provided in the corresponding Hugging Face repository)."
10
 
11
  vs_predictor_bert = ktrain.load_predictor('vs/bert')
12
  vs_predictor_mental = ktrain.load_predictor('vs/mentalbert')
@@ -31,13 +31,43 @@ vs_phs_io = Interface(fn=vs_PHSBERT, inputs="text", outputs="text")
31
  vs = Parallel(vs_bert_io, vs_mental_io, vs_phs_io,
32
  examples=vs_examples,
33
  title=vs_title,
34
- description=vs_desc,
35
- theme="peach")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  def model(text):
38
  return "Predictions unavailable - to be completed."
39
 
40
- hm = Interface(fn=model, inputs="text", outputs="text")
41
  dep = Interface(fn=model, inputs="text", outputs="text")
42
  covid = Interface(fn=model, inputs="text", outputs="text")
43
  suicide = Interface(fn=model, inputs="text", outputs="text")
 
5
  ["I only get my kids the ones I got....I've turned down many so called 'vaccines'"],
6
  ["In child protective services, further providing for definitions, for immunity from liability"],
7
  ["Lol what? Measles is a real thing. Get vaccinated"]]
8
+ vs_title = "Vaccine Sentiment Task"
9
+ vs_desc = "Enter vaccine-related tweets to generate sentiment from 3 models (BERT, MentalBERT, PHS-BERT). Label 0='vaccine critical', 1='neutral', 2='vaccine supportive'. The three provided examples have true labels 0,1,2 respectively. For more details, please refer to the VS2 description in our paper (linked provided in the corresponding Hugging Face repository)."
10
 
11
  vs_predictor_bert = ktrain.load_predictor('vs/bert')
12
  vs_predictor_mental = ktrain.load_predictor('vs/mentalbert')
 
31
  vs = Parallel(vs_bert_io, vs_mental_io, vs_phs_io,
32
  examples=vs_examples,
33
  title=vs_title,
34
+ description=vs_desc)
35
+
36
+ hm_examples = [
37
+ ["Serious as a heart attack question/thought Riddle me this. Why, oh why, does cold brew coffee get warm after sitting to long. Taste terrible. And Hot coffee get literally COLD after sitting too long. Tastes terrible. Like what. Why don't cold stay cold and hot only get warm?"],
38
+ ["It's odd how humans are considered predators when they have a heart attack and run like mad when a small insect is running straight towards them."],
39
+ ["The older we get the less likely we are to view a sudden massive heart attack as a tragedy than a stroke of good luck."]]
40
+ hm_title = "Health Mention Task"
41
+ hm_desc = "Enter health-related tweets to generate classification from 3 models (BERT, MentalBERT, PHS-BERT). Label 0='', 1='', 2=''. The three provided examples have true labels 0,1,2 respectively. For more details, please refer to the X description in our paper (linked provided in the corresponding Hugging Face repository)."
42
+
43
+ hm_predictor_bert = ktrain.load_predictor('hm/bert')
44
+ hm_predictor_mental = ktrain.load_predictor('hm/mentalbert')
45
+ hm_predictor_phs = ktrain.load_predictor('hm/phsbert')
46
+
47
+ def hm_BERT(text):
48
+ results = hm_predictor_bert.predict(str(text))
49
+ return str(results)
50
+
51
+ def hm_MentalBERT(text):
52
+ results = hm_predictor_mental.predict(str(text))
53
+ return str(results)
54
+
55
+ def hm_PHSBERT(text):
56
+ results = hm_predictor_phs.predict(str(text))
57
+ return str(results)
58
+
59
+ hm_bert_io = Interface(fn=hm_BERT, inputs="text", outputs="text")
60
+ hm_mental_io = Interface(fn=hm_MentalBERT, inputs="text", outputs="text")
61
+ hm_phs_io = Interface(fn=hm_PHSBERT, inputs="text", outputs="text")
62
+
63
+ hm = Parallel(hm_bert_io, hm_mental_io, hm_phs_io,
64
+ examples=hm_examples,
65
+ title=hm_title,
66
+ description=hm_desc)
67
 
68
  def model(text):
69
  return "Predictions unavailable - to be completed."
70
 
 
71
  dep = Interface(fn=model, inputs="text", outputs="text")
72
  covid = Interface(fn=model, inputs="text", outputs="text")
73
  suicide = Interface(fn=model, inputs="text", outputs="text")