File size: 556 Bytes
cada925
a47f7fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr
from transformers import pipeline

classifier = pipeline("image-classification", model="sahal-mulki/spotting-diffusion")

def predict(image):
    predictions = pipeline(image)
    return {p["label"]: p["score"] for p in predictions}


gr.Interface(fn=classify_image, 
             inputs=gr.inputs.Image(shape=(256, 256)),
             outputs=gr.outputs.Label(num_top_classes=2),
#             examples=["banana.jpg", "car.jpg"],             
             theme="default",
             css=".footer{display:none !important}").launch()