File size: 1,445 Bytes
6973085
 
66e0d8c
6973085
a317c9c
 
 
 
49c795b
 
8ea5273
d2c2419
 
0d42ce8
6973085
1cde9fb
cf82463
73adea4
cf82463
1cde9fb
cf82463
 
 
1cde9fb
90e8d13
 
cf82463
d2c2419
 
0d42ce8
3aaf0d3
a317c9c
49c795b
 
 
2b0cd0a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import ktrain
import gradio as gr
from gradio.mix import Parallel

examples = [
	["I only get my kids the ones I got....I've turned down many so called 'vaccines'"], 
	["In child protective services, further providing for definitions, for immunity from liability"], 
	["Lol what? Measles is a real thing. Get vaccinated"]]
title = "Vaccine Sentiment Task - VS2"
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)."

predictor_bert = ktrain.load_predictor('bert')
predictor_mental = ktrain.load_predictor('mentalbert')
predictor_phs = ktrain.load_predictor('phsbert')

def bert(text):
	results = predictor_bert.predict(str(text))
	return str(results)
	
def mentalbert(text):
	results = predictor_mental.predict(str(text))
	return str(results)
	
def phsbert(text):
	results = predictor_phs.predict(str(text))
	return str(results)

bert_io = gr.Interface(fn=bert, inputs="text", outputs="text")
mental_io = gr.Interface(fn=mentalbert, inputs="text", outputs="text")
phs_io = gr.Interface(fn=phsbert, inputs="text", outputs="text")

Parallel(bert_io, mental_io, phs_io, 
	examples=examples, 
	title=title, 
	description=desc,
	theme="peach").launch()