File size: 2,229 Bytes
37751e8
 
3048647
ed4d1bb
37751e8
 
 
ed4d1bb
 
3048647
ed4d1bb
 
 
37751e8
ed4d1bb
 
37751e8
 
ed4d1bb
 
37751e8
 
ed4d1bb
 
37751e8
 
ed4d1bb
 
 
37751e8
ed4d1bb
 
 
 
37751e8
 
 
 
 
 
d6e50e0
 
 
 
 
 
 
 
 
 
 
 
 
 
37751e8
ed4d1bb
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import ktrain
from gradio import Interface, Parallel, TabbedInterface

vs_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"]]
vs_title = "Vaccine Sentiment Task - VS2"
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)."

vs_predictor_bert = ktrain.load_predictor('vs/bert')
vs_predictor_mental = ktrain.load_predictor('vs/mentalbert')
vs_predictor_phs = ktrain.load_predictor('vs/phsbert')

def vs_BERT(text):
	results = vs_predictor_bert.predict(str(text))
	return str(results)
	
def vs_MentalBERT(text):
`	results = vs_predictor_mental.predict(str(text))
	return str(results)
	
def vs_PHSBERT(text):
	results = vs_predictor_phs.predict(str(text))
	return str(results)

vs_bert_io = Interface(fn=vs_BERT, inputs="text", outputs="text")
vs_mental_io = Interface(fn=vs_MentalBERT, inputs="text", outputs="text")
vs_phs_io = Interface(fn=vs_PHSBERT, inputs="text", outputs="text")

vs = Parallel(vs_bert_io, vs_mental_io, vs_phs_io, 
	examples=vs_examples, 
	title=vs_title, 
	description=vs_desc,
	theme="peach")
	
def model(text):
	return "Predictions unavailable - to be completed."

hm = Interface(fn=model, inputs="text", outputs="text")
dep = Interface(fn=model, inputs="text", outputs="text")
covid = Interface(fn=model, inputs="text", outputs="text")
suicide = Interface(fn=model, inputs="text", outputs="text")
stress = Interface(fn=model, inputs="text", outputs="text")
other = Interface(fn=model, inputs="text", outputs="text")

interfaces = [vs, hm, dep, covid, suicide, stress, other]
interface_names = ["Vaccine Sentiment Task", 
	"Health Mention Task",
	"Depression Task",
	"COVID Related Task",
	"Suicide Task",
	"Stress Task",
	"Other Health Related Task"]

TabbedInterface(interfaces, interface_names).launch()