Chan Lee commited on
Commit
5240935
1 Parent(s): f56bb9a
Files changed (1) hide show
  1. app.py +15 -30
app.py CHANGED
@@ -84,16 +84,13 @@ vs_predictor_mental = ktrain.load_predictor(folder + "mentalbert")
84
  vs_predictor_phs = ktrain.load_predictor(folder + "phsbert")
85
 
86
  def vs_BERT(text):
87
- results = vs_predictor_bert.predict(str(text))
88
- return "BERT:" + str(results)
89
 
90
  def vs_MentalBERT(text):
91
- results = vs_predictor_mental.predict(str(text))
92
- return "MentalBERT:" + str(results)
93
 
94
  def vs_PHSBERT(text):
95
- results = vs_predictor_phs.predict(str(text))
96
- return "PHS-BERT:" + str(results)
97
 
98
  vs_bert_io = Interface(fn=vs_BERT, inputs="text", outputs="text")
99
  vs_mental_io = Interface(fn=vs_MentalBERT, inputs="text", outputs="text")
@@ -109,16 +106,13 @@ hm_predictor_mental = ktrain.load_predictor(folder + "mentalbert")
109
  hm_predictor_phs = ktrain.load_predictor(folder + "phsbert")
110
 
111
  def hm_BERT(text):
112
- results = hm_predictor_bert.predict(str(text))
113
- return "BERT:" + str(results)
114
 
115
  def hm_MentalBERT(text):
116
- results = hm_predictor_mental.predict(str(text))
117
- return "MentalBERT:" + str(results)
118
 
119
  def hm_PHSBERT(text):
120
- results = hm_predictor_phs.predict(str(text))
121
- return "PHS-BERT:" + str(results)
122
 
123
  hm_bert_io = Interface(fn=hm_BERT, inputs="text", outputs="text")
124
  hm_mental_io = Interface(fn=hm_MentalBERT, inputs="text", outputs="text")
@@ -134,16 +128,13 @@ covid_predictor_mental = ktrain.load_predictor(folder + "mentalbert")
134
  covid_predictor_phs = ktrain.load_predictor(folder + "phsbert")
135
 
136
  def covid_BERT(text):
137
- results = covid_predictor_bert.predict(str(text))
138
- return "BERT:" + str(results)
139
 
140
  def covid_MentalBERT(text):
141
- results = covid_predictor_mental.predict(str(text))
142
- return "MentalBERT:" + str(results)
143
 
144
  def covid_PHSBERT(text):
145
- results = covid_predictor_phs.predict(str(text))
146
- return "PHS-BERT:" + str(results)
147
 
148
  covid_bert_io = Interface(fn=covid_BERT, inputs="text", outputs="text")
149
  covid_mental_io = Interface(fn=covid_MentalBERT, inputs="text", outputs="text")
@@ -159,16 +150,13 @@ stress_predictor_mental = ktrain.load_predictor(folder + "mentalbert")
159
  stress_predictor_phs = ktrain.load_predictor(folder + "phsbert")
160
 
161
  def stress_BERT(text):
162
- results = stress_predictor_bert.predict(str(text))
163
- return "BERT:" + str(results)
164
 
165
  def stress_MentalBERT(text):
166
- results = stress_predictor_mental.predict(str(text))
167
- return "MentalBERT:" + str(results)
168
 
169
  def stress_PHSBERT(text):
170
- results = stress_predictor_phs.predict(str(text))
171
- return "PHS-BERT:" + str(results)
172
 
173
  stress_bert_io = Interface(fn=stress_BERT, inputs="text", outputs="text")
174
  stress_mental_io = Interface(fn=stress_MentalBERT, inputs="text", outputs="text")
@@ -184,16 +172,13 @@ other_predictor_mental = ktrain.load_predictor(folder + "mentalbert")
184
  other_predictor_phs = ktrain.load_predictor(folder + "phsbert")
185
 
186
  def other_BERT(text):
187
- results = other_predictor_bert.predict(str(text))
188
- return "BERT:" + str(results)
189
 
190
  def other_MentalBERT(text):
191
- results = other_predictor_mental.predict(str(text))
192
- return "MentalBERT:" + str(results)
193
 
194
  def other_PHSBERT(text):
195
- results = other_predictor_phs.predict(str(text))
196
- return "PHS-BERT:" + str(results)
197
 
198
  other_bert_io = Interface(fn=other_BERT, inputs="text", outputs="text")
199
  other_mental_io = Interface(fn=other_MentalBERT, inputs="text", outputs="text")
 
84
  vs_predictor_phs = ktrain.load_predictor(folder + "phsbert")
85
 
86
  def vs_BERT(text):
87
+ return "BERT:" + str(vs_predictor_bert.predict(str(text)))
 
88
 
89
  def vs_MentalBERT(text):
90
+ return "MentalBERT:" + str(vs_predictor_mental.predict(str(text)))
 
91
 
92
  def vs_PHSBERT(text):
93
+ return "PHS-BERT:" + str(vs_predictor_phs.predict(str(text)))
 
94
 
95
  vs_bert_io = Interface(fn=vs_BERT, inputs="text", outputs="text")
96
  vs_mental_io = Interface(fn=vs_MentalBERT, inputs="text", outputs="text")
 
106
  hm_predictor_phs = ktrain.load_predictor(folder + "phsbert")
107
 
108
  def hm_BERT(text):
109
+ return "BERT:" + str(hm_predictor_bert.predict(str(text)))
 
110
 
111
  def hm_MentalBERT(text):
112
+ return "MentalBERT:" + str(hm_predictor_mental.predict(str(text)))
 
113
 
114
  def hm_PHSBERT(text):
115
+ return "PHS-BERT:" + str(hm_predictor_phs.predict(str(text)))
 
116
 
117
  hm_bert_io = Interface(fn=hm_BERT, inputs="text", outputs="text")
118
  hm_mental_io = Interface(fn=hm_MentalBERT, inputs="text", outputs="text")
 
128
  covid_predictor_phs = ktrain.load_predictor(folder + "phsbert")
129
 
130
  def covid_BERT(text):
131
+ return "BERT:" + str(covid_predictor_bert.predict(str(text)))
 
132
 
133
  def covid_MentalBERT(text):
134
+ return "MentalBERT:" + str(covid_predictor_mental.predict(str(text)))
 
135
 
136
  def covid_PHSBERT(text):
137
+ return "PHS-BERT:" + str(covid_predictor_phs.predict(str(text)))
 
138
 
139
  covid_bert_io = Interface(fn=covid_BERT, inputs="text", outputs="text")
140
  covid_mental_io = Interface(fn=covid_MentalBERT, inputs="text", outputs="text")
 
150
  stress_predictor_phs = ktrain.load_predictor(folder + "phsbert")
151
 
152
  def stress_BERT(text):
153
+ return "BERT:" + str(stress_predictor_bert.predict(str(text)))
 
154
 
155
  def stress_MentalBERT(text):
156
+ return "MentalBERT:" + str(stress_predictor_mental.predict(str(text)))
 
157
 
158
  def stress_PHSBERT(text):
159
+ return "PHS-BERT:" + str(stress_predictor_phs.predict(str(text)))
 
160
 
161
  stress_bert_io = Interface(fn=stress_BERT, inputs="text", outputs="text")
162
  stress_mental_io = Interface(fn=stress_MentalBERT, inputs="text", outputs="text")
 
172
  other_predictor_phs = ktrain.load_predictor(folder + "phsbert")
173
 
174
  def other_BERT(text):
175
+ return "BERT:" + str(other_predictor_bert.predict(str(text)))
 
176
 
177
  def other_MentalBERT(text):
178
+ return "MentalBERT:" + str(other_predictor_mental.predict(str(text)))
 
179
 
180
  def other_PHSBERT(text):
181
+ return "PHS-BERT:" + str(other_predictor_phs.predict(str(text)))
 
182
 
183
  other_bert_io = Interface(fn=other_BERT, inputs="text", outputs="text")
184
  other_mental_io = Interface(fn=other_MentalBERT, inputs="text", outputs="text")