Testing NLP side
Browse files
app.py
CHANGED
|
@@ -33,9 +33,8 @@ def moderate_image(img):
|
|
| 33 |
def classify_toxic(text):
|
| 34 |
batch = tokenizer.encode(text, return_tensors="pt")
|
| 35 |
output = model(batch)
|
| 36 |
-
output
|
| 37 |
-
|
| 38 |
-
return "Toxic" if output.index(max_idx) == 1 else "Neutral"
|
| 39 |
|
| 40 |
|
| 41 |
# -----------------------
|
|
@@ -110,7 +109,7 @@ body, .gradio-container {
|
|
| 110 |
.footer {
|
| 111 |
flex-shrink: 0;
|
| 112 |
text-align: center;
|
| 113 |
-
font-size: 0.
|
| 114 |
opacity: 0.6;
|
| 115 |
padding: 14px 0;
|
| 116 |
border-top: 1px solid rgba(var(--block-border-color-rgb), 0.12);
|
|
@@ -164,4 +163,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(share=True)
|
|
|
|
| 33 |
def classify_toxic(text):
|
| 34 |
batch = tokenizer.encode(text, return_tensors="pt")
|
| 35 |
output = model(batch)
|
| 36 |
+
print(output)
|
| 37 |
+
return output
|
|
|
|
| 38 |
|
| 39 |
|
| 40 |
# -----------------------
|
|
|
|
| 109 |
.footer {
|
| 110 |
flex-shrink: 0;
|
| 111 |
text-align: center;
|
| 112 |
+
font-size: 0.80rem;
|
| 113 |
opacity: 0.6;
|
| 114 |
padding: 14px 0;
|
| 115 |
border-top: 1px solid rgba(var(--block-border-color-rgb), 0.12);
|
|
|
|
| 163 |
gr.Markdown("<div class='footer'>Demo by 7th • Powered by Transformers</div>")
|
| 164 |
|
| 165 |
if __name__ == "__main__":
|
| 166 |
+
demo.launch(share=True, analytics_enabled=False)
|