File size: 1,075 Bytes
009aa6f
 
 
 
 
 
 
 
4c6aa6e
009aa6f
 
4c6aa6e
 
009aa6f
942991c
009aa6f
 
 
 
 
 
 
 
 
 
 
4c6aa6e
942991c
009aa6f
 
4c6aa6e
 
009aa6f
 
 
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
28
29
30
31
32
33
34
35
36
import gradio as gr
from transformers import pipeline

pipeline = pipeline(
    "image-classification", model="p1atdev/siglip-tagger-test-3", trust_remote_code=True
)


def predict(input_img,threshold,return_scores):
    predictions = pipeline(
        input_img,
        threshold=threshold,  # optional parameter defaults to 0
        return_scores=return_scores,  # optional parameter defaults to False
    )
    return predictions


description = """
image annotation pipeline using [`p1atdev/siglip-tagger-test-3`](https://huggingface.co/p1atdev/siglip-tagger-test-3) model **( β€’Μ€ Ο‰ ‒́ )y**

shoutout to [@p1atdev](https://huggingface.co/p1atdev) for his awesome work **~(=^β€₯^)γƒŽ**
"""


app = gr.Interface(
    predict,
    inputs=[gr.Image(label="add your image here"),gr.Slider(0,1,0.5,label="threshold"),gr.Checkbox(False,label="show scores")],
    outputs=gr.Text(label="tags"),
    title="Image Annotator",
    description=description,
    examples=[["./lowres XD.jpg",0.5,False],["./pixeled lain.jpg",0.8,True]],
    cache_examples=True
)

app.launch()