fw7th commited on
Commit
409ea56
·
1 Parent(s): 6d3cb04

updated app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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).cpu()
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=6, label="Enter Text")
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