Made site shareable
Browse files
app.py
CHANGED
|
@@ -33,7 +33,7 @@ def moderate_image(img):
|
|
| 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"
|
| 39 |
|
|
@@ -164,4 +164,4 @@ with gr.Blocks(
|
|
| 164 |
gr.Markdown("<div class='footer'>Demo by 7th • Powered by Transformers</div>")
|
| 165 |
|
| 166 |
if __name__ == "__main__":
|
| 167 |
-
demo.launch()
|
|
|
|
| 33 |
def classify_toxic(text):
|
| 34 |
batch = tokenizer.encode(text, return_tensors="pt")
|
| 35 |
output = model(batch)
|
| 36 |
+
output = output[0].tolist()
|
| 37 |
max_idx = max(output)
|
| 38 |
return "Toxic" if output.index(max_idx) == 1 else "Neutral"
|
| 39 |
|
|
|
|
| 164 |
gr.Markdown("<div class='footer'>Demo by 7th • Powered by Transformers</div>")
|
| 165 |
|
| 166 |
if __name__ == "__main__":
|
| 167 |
+
demo.launch(share=True)
|