momo commited on
Commit
3055a8f
β€’
1 Parent(s): fc2acc8
Files changed (1) hide show
  1. app.py +18 -9
app.py CHANGED
@@ -64,17 +64,26 @@ if __name__ == '__main__':
64
  "momo/KcBERT-base_Hate_speech_Privacy_Detection",
65
  ]
66
 
67
- #Create a gradio app with a button that calls predict()
68
- app = gr.Interface(
69
- fn=predict,
70
- inputs=[gr.inputs.Dropdown(model_name_list, label="Model Name"), 'text'], outputs=['label'],
71
- examples = [[MODEL_BUF["name"], text], [MODEL_BUF["name"], "4=πŸ¦€ 4β‰ πŸ¦€"]],
72
- title="ν•œκ΅­μ–΄ ν˜μ˜€ν‘œν˜„, κ°œμΈμ •λ³΄ νŒλ³„κΈ° (Korean Hate Speech and Privacy Detection)",
73
- description="Korean Hate Speech and Privacy Detection."
74
- )
75
- app.launch()
76
 
77
 
 
 
 
 
 
 
 
 
 
78
 
79
  # # global var
80
  # MODEL_NAME = 'jason9693/SoongsilBERT-base-beep'
 
64
  "momo/KcBERT-base_Hate_speech_Privacy_Detection",
65
  ]
66
 
67
+ # #Create a gradio app with a button that calls predict()
68
+ # app = gr.Interface(
69
+ # fn=predict,
70
+ # inputs=[gr.inputs.Dropdown(model_name_list, label="Model Name"), 'text'], outputs=['label'],
71
+ # examples = [[MODEL_BUF["name"], text], [MODEL_BUF["name"], "4=πŸ¦€ 4β‰ πŸ¦€"]],
72
+ # title="ν•œκ΅­μ–΄ ν˜μ˜€ν‘œν˜„, κ°œμΈμ •λ³΄ νŒλ³„κΈ° (Korean Hate Speech and Privacy Detection)",
73
+ # description="Korean Hate Speech and Privacy Detection."
74
+ # )
75
+ # app.launch()
76
 
77
 
78
+ pipe = TextClassificationPipeline(
79
+ model = model,
80
+ tokenizer = tokenizer,
81
+ return_all_scores=True,
82
+ function_to_apply='sigmoid'
83
+ )
84
+
85
+ gr.Interface.from_pipeline(pipe).launch()
86
+
87
 
88
  # # global var
89
  # MODEL_NAME = 'jason9693/SoongsilBERT-base-beep'