publichealthsurveillance commited on
Commit
ac955e7
1 Parent(s): f3ea063

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -19
app.py CHANGED
@@ -14,15 +14,15 @@ vs_predictor_phs = ktrain.load_predictor('vs/phsbert')
14
 
15
  def vs_BERT(text):
16
  results = vs_predictor_bert.predict(str(text))
17
- return str(results)
18
 
19
  def vs_MentalBERT(text):
20
  results = vs_predictor_mental.predict(str(text))
21
- return str(results)
22
 
23
  def vs_PHSBERT(text):
24
  results = vs_predictor_phs.predict(str(text))
25
- return str(results)
26
 
27
  vs_bert_io = Interface(fn=vs_BERT, inputs="text", outputs="text")
28
  vs_mental_io = Interface(fn=vs_MentalBERT, inputs="text", outputs="text")
@@ -46,15 +46,15 @@ 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")
@@ -65,22 +65,24 @@ hm = Parallel(hm_bert_io, hm_mental_io, hm_phs_io,
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")
74
- stress = Interface(fn=model, inputs="text", outputs="text")
75
- other = Interface(fn=model, inputs="text", outputs="text")
76
 
77
  interfaces = [vs, hm, dep, covid, suicide, stress, other]
78
- interface_names = ["Vaccine Sentiment Task",
79
- "Health Mention Task",
80
- "Depression Task",
81
- "COVID Related Task",
82
- "Suicide Task",
83
- "Stress Task",
84
- "Other Health Related Task"]
85
 
86
  TabbedInterface(interfaces, interface_names).launch()
 
14
 
15
  def vs_BERT(text):
16
  results = vs_predictor_bert.predict(str(text))
17
+ return "BERT:" + str(results)
18
 
19
  def vs_MentalBERT(text):
20
  results = vs_predictor_mental.predict(str(text))
21
+ return "MentalBERT:" + str(results)
22
 
23
  def vs_PHSBERT(text):
24
  results = vs_predictor_phs.predict(str(text))
25
+ return "PHS-BERT:" + str(results)
26
 
27
  vs_bert_io = Interface(fn=vs_BERT, inputs="text", outputs="text")
28
  vs_mental_io = Interface(fn=vs_MentalBERT, inputs="text", outputs="text")
 
46
 
47
  def hm_BERT(text):
48
  results = hm_predictor_bert.predict(str(text))
49
+ return "BERT:" + str(results)
50
 
51
  def hm_MentalBERT(text):
52
  results = hm_predictor_mental.predict(str(text))
53
+ return "MentalBERT" + str(results)
54
 
55
  def hm_PHSBERT(text):
56
  results = hm_predictor_phs.predict(str(text))
57
+ return "PHS-BERT" + 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")
 
65
  title=hm_title,
66
  description=hm_desc)
67
 
68
+ dep_title = "Depression Task"
69
+ covid_title = "COVID Related Task"
70
+ suicide_title = "Suicide Task"
71
+ stress_title = "Stress Task"
72
+ other_title = "Other Health Related Task"
73
+
74
+ desc = "Task is currently unavailable."
75
+
76
  def model(text):
77
+ return "Predictions are currently unavailable."
78
 
79
+ dep = Interface(fn=model, inputs="text", outputs="text", title=dep_title, description=desc)
80
+ covid = Interface(fn=model, inputs="text", outputs="text", title=covid_title, description=desc)
81
+ suicide = Interface(fn=model, inputs="text", outputs="text", title=suicide_title, description=desc)
82
+ stress = Interface(fn=model, inputs="text", outputs="text", title=stress_title, description=desc)
83
+ other = Interface(fn=model, inputs="text", outputs="text", title=other_title, description=desc)
84
 
85
  interfaces = [vs, hm, dep, covid, suicide, stress, other]
86
+ interface_names = [vs_title, hm_title, dep_title, covid_title, suicide_title, stress_title, other_title]
 
 
 
 
 
 
87
 
88
  TabbedInterface(interfaces, interface_names).launch()