Spaces:
Sleeping
Sleeping
add app
Browse files
app.py
CHANGED
@@ -6,34 +6,6 @@ from transformers import AutoTokenizer, BertForSequenceClassification, AutoModel
|
|
6 |
from transformers import TextClassificationPipeline
|
7 |
import gradio as gr
|
8 |
|
9 |
-
# tokenizer = AutoTokenizer.from_pretrained('momo/KcELECTRA-base_Hate_speech_Privacy_Detection')
|
10 |
-
# model = AutoModelForSequenceClassification.from_pretrained(
|
11 |
-
# 'momo/KcELECTRA-base_Hate_speech_Privacy_Detection',
|
12 |
-
# num_labels= 15,
|
13 |
-
# problem_type="multi_label_classification"
|
14 |
-
# )
|
15 |
-
|
16 |
-
# pipe = TextClassificationPipeline(
|
17 |
-
# model = model,
|
18 |
-
# tokenizer = tokenizer,
|
19 |
-
# return_all_scores=True,
|
20 |
-
# function_to_apply='sigmoid'
|
21 |
-
# )
|
22 |
-
|
23 |
-
# def predict(text):
|
24 |
-
# return pipe(text)[0]
|
25 |
-
|
26 |
-
# iface = gr.Interface(
|
27 |
-
# fn=predict,
|
28 |
-
# inputs='text',
|
29 |
-
# outputs='text',
|
30 |
-
# examples=[["Hello! My name is Omar"]]
|
31 |
-
# )
|
32 |
-
|
33 |
-
# iface.launch()
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
# global var
|
38 |
MODEL_NAME = 'momo/KcBERT-base_Hate_speech_Privacy_Detection'
|
39 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
|
@@ -87,7 +59,7 @@ if __name__ == '__main__':
|
|
87 |
#Create a gradio app with a button that calls predict()
|
88 |
app = gr.Interface(
|
89 |
fn=predict,
|
90 |
-
inputs=[gr.inputs.Dropdown(model_name_list, label="Model Name"), 'text'], outputs=
|
91 |
examples = [[MODEL_BUF["name"], text], [MODEL_BUF["name"], "4=๐ฆ 4โ ๐ฆ"]],
|
92 |
title="ํ๊ตญ์ด ํ์คํํ, ๊ฐ์ธ์ ๋ณด ํ๋ณ๊ธฐ (Korean Hate Speech and Privacy Detection)",
|
93 |
description="Korean Hate Speech and Privacy Detection."
|
|
|
6 |
from transformers import TextClassificationPipeline
|
7 |
import gradio as gr
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
# global var
|
10 |
MODEL_NAME = 'momo/KcBERT-base_Hate_speech_Privacy_Detection'
|
11 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
|
|
|
59 |
#Create a gradio app with a button that calls predict()
|
60 |
app = gr.Interface(
|
61 |
fn=predict,
|
62 |
+
inputs=[gr.inputs.Dropdown(model_name_list, label="Model Name"), 'text'], outputs='text',
|
63 |
examples = [[MODEL_BUF["name"], text], [MODEL_BUF["name"], "4=๐ฆ 4โ ๐ฆ"]],
|
64 |
title="ํ๊ตญ์ด ํ์คํํ, ๊ฐ์ธ์ ๋ณด ํ๋ณ๊ธฐ (Korean Hate Speech and Privacy Detection)",
|
65 |
description="Korean Hate Speech and Privacy Detection."
|