import gradio as gr | |
from huggingface_hub import AsyncInferenceClient | |
client = AsyncInferenceClient() | |
def image_classifier(inp): | |
class_names = ["0", "1"] | |
inp.save("why.png") | |
sunflower_path = "why.png" | |
r = await client.zero_shot_image_classification("why.png", labels=["mouth", "other"]) | |
return r | |
demo = gr.Interface(fn=image_classifier, inputs=gr.Image(type="pil"), outputs="label") | |
demo.launch(debug=True) | |