publichealthsurveillance commited on
Commit
b5eb59d
1 Parent(s): 49c795b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -7,27 +7,27 @@ examples = [
7
  ["In child protective services, further providing for definitions, for immunity from liability"],
8
  ["Lol what? Measles is a real thing. Get vaccinated"]]
9
  title = "Vaccine Sentiment Task - VS2"
10
- 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 are labelled 0,1,2 respectively. For details about VS2, refer to our paper (linked provided in https://huggingface.co/publichealthsurveillance/PHS-BERT)."
11
 
12
  predictor_bert = ktrain.load_predictor('bert')
13
  predictor_mental = ktrain.load_predictor('mentalbert')
14
  predictor_phs = ktrain.load_predictor('phsbert')
15
 
16
- def bert(text):
17
  results = predictor_bert.predict(str(text))
18
  return str(results)
19
 
20
- def mentalbert(text):
21
  results = predictor_mental.predict(str(text))
22
  return str(results)
23
 
24
- def phsbert(text):
25
  results = predictor_phs.predict(str(text))
26
  return str(results)
27
 
28
- bert_io = gr.Interface(fn=bert, inputs="text", outputs="text")
29
- mental_io = gr.Interface(fn=mentalbert, inputs="text", outputs="text")
30
- phs_io = gr.Interface(fn=phsbert, inputs="text", outputs="text")
31
 
32
  Parallel(bert_io, mental_io, phs_io,
33
  examples=examples,
 
7
  ["In child protective services, further providing for definitions, for immunity from liability"],
8
  ["Lol what? Measles is a real thing. Get vaccinated"]]
9
  title = "Vaccine Sentiment Task - VS2"
10
+ 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 are labelled 0,1,2 respectively. For details about VS2, please refer to our paper (linked provided in the corresponding Hugging Face repository)."
11
 
12
  predictor_bert = ktrain.load_predictor('bert')
13
  predictor_mental = ktrain.load_predictor('mentalbert')
14
  predictor_phs = ktrain.load_predictor('phsbert')
15
 
16
+ def BERT(text):
17
  results = predictor_bert.predict(str(text))
18
  return str(results)
19
 
20
+ def MentalBERT(text):
21
  results = predictor_mental.predict(str(text))
22
  return str(results)
23
 
24
+ def PHS-BERT(text):
25
  results = predictor_phs.predict(str(text))
26
  return str(results)
27
 
28
+ bert_io = gr.Interface(fn=BERT, inputs="text", outputs="text")
29
+ mental_io = gr.Interface(fn=MentalBERT, inputs="text", outputs="text")
30
+ phs_io = gr.Interface(fn=PHS-BERT, inputs="text", outputs="text")
31
 
32
  Parallel(bert_io, mental_io, phs_io,
33
  examples=examples,