Spaces:
Sleeping
Sleeping
Tirath5504
commited on
Commit
•
f260cda
1
Parent(s):
9a88ef0
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import torch
|
2 |
from transformers import ViTForImageClassification, ViTImageProcessor
|
|
|
3 |
from PIL import Image
|
4 |
import gradio as gr
|
5 |
|
@@ -28,7 +29,7 @@ def predict(image):
|
|
28 |
|
29 |
iface = gr.Interface(fn=predict,
|
30 |
inputs=gr.Image(type="pil"),
|
31 |
-
outputs=[gr.Label(num_top_classes=1),gr.Label()]
|
32 |
title="Hateful Content Detection",
|
33 |
description="Upload an image to classify hateful gestures or symbols")
|
34 |
|
|
|
1 |
import torch
|
2 |
from transformers import ViTForImageClassification, ViTImageProcessor
|
3 |
+
import torch.nn.functional as F
|
4 |
from PIL import Image
|
5 |
import gradio as gr
|
6 |
|
|
|
29 |
|
30 |
iface = gr.Interface(fn=predict,
|
31 |
inputs=gr.Image(type="pil"),
|
32 |
+
outputs=[gr.Label(num_top_classes=1, label="Class"), gr.Label(label="Score")],
|
33 |
title="Hateful Content Detection",
|
34 |
description="Upload an image to classify hateful gestures or symbols")
|
35 |
|