File size: 840 Bytes
ab685db
b853b00
 
ab685db
b853b00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fb325b8
 
 
b853b00
fb325b8
 
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
# Use a pipeline as a high-level helper
from transformers import pipeline

# pipe = pipeline("zero-shot-image-classification", model="google/siglip-base-patch16-256-multilingual")

# gr.load("models/wisdomik/QuiltNet-B-16").launch()

# gr.load("models/google/siglip-base-patch16-256-multilingual").launch()

# gr.Interface.from_pipeline(pipe).launch()

classifier = pipeline(model="google/siglip-so400m-patch14-384")
result = classifier(
    "https://huggingface.co./datasets/Narsil/image_dummy/raw/main/parrots.png",
    candidate_labels=["animals", "humans", "landscape"],
)

print(result)

def greet(name, candidate_labels):
    print(type(candidate_labels))
    return "Hello " + name + "!!" + candidate_labels

demo = gr.Interface(fn=greet, inputs=["text","text"], outputs="text")
demo.queue(api_open=True).launch()