File size: 687 Bytes
928850a
c85f547
928850a
51c84a8
 
928850a
171aa30
928850a
51c84a8
 
 
 
 
 
 
acbd102
928850a
 
 
 
 
 
171aa30
928850a
171aa30
acbd102
928850a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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()