File size: 570 Bytes
1bac567
 
464daab
 
1bac567
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os 
import huggingface_hub as hf_hub
import gradio as gr

client = hf_hub.InferenceClient(token = os.environ['HF_TOKEN'])
client.headers["x-use-cache"] = "0" 

def predict(image, label_list):
    labels = label_list.split(",")
    response = zero_shot_image_classification(
        image,
        labels
    )

    return response

app = gr.Interface(
    fn = predict, 
    inputs = [
        gr.Image(), 
        gr.Textbox()
    ], 
    outputs = gr.Label(), 
    title = 'Zero Shot Image Classification',
    description = 'Vinay Kumar Thakur'
)

app.launch()