sosoxa's picture
Update app.py
f7889cb verified
raw
history blame
633 Bytes
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()