File size: 633 Bytes
137940e
ab92104
137940e
f7889cb
ab92104
 
f7889cb
 
ab92104
f7889cb
ab92104
f7889cb
 
ab92104
 
 
 
f7889cb
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from transformers import pipeline

image_classifier = pipeline(task="image-classification", model="models/aioxlabs/dvoice-darija")

def predict(input_img):
    predictions = image_classifier(input_img)
    return input_img, {p["label"]: p["score"] for p in predictions}

gr_interface = gr.Interface(
    predict,
    inputs=gr.inputs.Image(label="Select hot dog candidate", source=['upload', 'webcam'], type="pil"),
    outputs=[gr.outputs.Image(label="Processed Image"), gr.outputs.Label(label="Result", num_top_classes=2)],
    title="Hot Dog? Or Not?",
)

if __name__ == "__main__":
    gr_interface.launch()