Spaces:
Sleeping
Sleeping
File size: 616 Bytes
556d2a2 ab03079 556d2a2 ab03079 556d2a2 ab03079 556d2a2 ab03079 556d2a2 1e693c2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import gradio as gr
from model import Detector
from PIL import Image
m = Detector()
m.load('./toxic_detection_res50.gz.tar')
def image_toxic_detect(im):
return m.detect(Image.fromarray(im))["toxic_score"]
with gr.Blocks() as app:
gr.Markdown("app")
with gr.Tab("Toxic Image Detector"):
image_input_toxic = gr.Image()
image_output_toxic = gr.Label(num_top_classes=2)
image_button_toxic = gr.Button("image_toxic")
# image
image_button_toxic.click(image_toxic_detect, inputs=image_input_toxic, outputs=image_output_toxic)
app.launch(server_name="0.0.0.0")
|