Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from pathlib import Path | |
| from transformers import pipeline | |
| from PIL import Image | |
| import os, os.path | |
| pipeline = pipeline("image-classification", model="Ant-Onion/dummy-model", feature_extractor = "Ant-Onion/dummy-model") | |
| imgs = [] | |
| path = "./images" | |
| lista = os.listdir(path) | |
| examples =list(map(lambda x: os.path.join(path,x), lista)) | |
| def predict(image): | |
| predictions = pipeline(image) | |
| return {p["label"]: p["score"] for p in predictions} | |
| gr.Interface( | |
| predict, | |
| inputs=gr.inputs.Image(label="Upload THE BIRDOOOOO", type="filepath"), | |
| outputs=gr.outputs.Label(num_top_classes=2), | |
| title="CUTE BIRD OR UGRLY BORD", | |
| examples=examples, | |
| ).launch() |