PHS-BERT / app.py
publichealthsurveillance's picture
Update app.py
10fc93c
raw
history blame
1.24 kB
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"]]
# predictor_bert = ktrain.load_predictor('bert')
# predictor_mental = ktrain.load_predictor('mentalbert')
predictor_phs = ktrain.load_predictor('phsbert')
predictor_phs.predict("I only get my kids the ones I got....I've turned down many so called 'vaccines'")
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):
return str(predictor_phs)
# 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).launch()
# Parallel(bert_io, mental_io, examples=examples).launch()
# bert_io.launch()
# mental_io.launch()
phs_io.launch()