publichealthsurveillance commited on
Commit
1cde9fb
1 Parent(s): da1ec8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -2,28 +2,28 @@ import ktrain
2
  import gradio as gr
3
  from gradio.mix import Parallel
4
 
5
- # predictor_bert = ktrain.load_predictor('bert')
6
- # predictor_mental = ktrain.load_predictor('mentalbert')
7
- predictor_phs = ktrain.load_predictor('phsbert')
8
 
9
- def func_bert(text):
10
  results = predictor_bert.predict(str(text))
11
  return str(results)
12
 
13
- def func_mental(text):
14
  results = predictor_mental.predict(str(text))
15
  return str(results)
16
 
17
- def func_phs(text):
18
  results = predictor_phs.predict(str(text))
19
  return str(results)
20
 
21
- # bert_io = gr.Interface(fn=func_bert, inputs="text", outputs="text")
22
- # mental_io = gr.Interface(fn=func_mental, inputs="text", outputs="text")
23
- phs_io = gr.Interface(fn=func_phs, inputs="text", outputs="text")
24
 
25
  # Parallel(bert_io, mental_io, phs_io).launch()
26
- # Parallel(bert_io, mental_io).launch()
27
  # bert_io.launch()
28
  # mental_io.launch()
29
- phs_io.launch()
 
2
  import gradio as gr
3
  from gradio.mix import Parallel
4
 
5
+ predictor_bert = ktrain.load_predictor('bert')
6
+ predictor_mental = ktrain.load_predictor('mentalbert')
7
+ # predictor_phs = ktrain.load_predictor('phsbert')
8
 
9
+ def bert(text):
10
  results = predictor_bert.predict(str(text))
11
  return str(results)
12
 
13
+ def mentalbert(text):
14
  results = predictor_mental.predict(str(text))
15
  return str(results)
16
 
17
+ def phsbert(text):
18
  results = predictor_phs.predict(str(text))
19
  return str(results)
20
 
21
+ bert_io = gr.Interface(fn=bert, inputs="text", outputs="text")
22
+ mental_io = gr.Interface(fn=mentalbert, inputs="text", outputs="text")
23
+ # phs_io = gr.Interface(fn=phsbert, inputs="text", outputs="text")
24
 
25
  # Parallel(bert_io, mental_io, phs_io).launch()
26
+ Parallel(bert_io, mental_io).launch()
27
  # bert_io.launch()
28
  # mental_io.launch()
29
+ # phs_io.launch()