updated app.py
Browse files
app.py
CHANGED
|
@@ -32,7 +32,7 @@ def moderate_image(img):
|
|
| 32 |
|
| 33 |
def classify_toxic(text):
|
| 34 |
batch = tokenizer.encode(text, return_tensors="pt")
|
| 35 |
-
output = model(batch)
|
| 36 |
output = output.tolist()
|
| 37 |
max_idx = max(output)
|
| 38 |
return "Toxic" if output.index(max_idx) == 1 else "Neutral"
|
|
@@ -151,7 +151,7 @@ with gr.Blocks(
|
|
| 151 |
with gr.Row():
|
| 152 |
with gr.Column(scale=3):
|
| 153 |
with gr.Group(elem_classes="apple-card"):
|
| 154 |
-
txt_in = gr.Textbox(lines=
|
| 155 |
classify_txt_btn = gr.Button("Analyze")
|
| 156 |
text_clear_btn = gr.ClearButton(components=txt_in)
|
| 157 |
|
|
|
|
| 32 |
|
| 33 |
def classify_toxic(text):
|
| 34 |
batch = tokenizer.encode(text, return_tensors="pt")
|
| 35 |
+
output = model(batch)
|
| 36 |
output = output.tolist()
|
| 37 |
max_idx = max(output)
|
| 38 |
return "Toxic" if output.index(max_idx) == 1 else "Neutral"
|
|
|
|
| 151 |
with gr.Row():
|
| 152 |
with gr.Column(scale=3):
|
| 153 |
with gr.Group(elem_classes="apple-card"):
|
| 154 |
+
txt_in = gr.Textbox(lines=4, label="Enter Text")
|
| 155 |
classify_txt_btn = gr.Button("Analyze")
|
| 156 |
text_clear_btn = gr.ClearButton(components=txt_in)
|
| 157 |
|