Gradio-lite (Gradio running entirely in your browser!)
Try it out! Once the Gradio app loads (can take 10-15 seconds), disconnect your Wifi and the machine learning model will still work!
transformers_js_py
from transformers_js import import_transformers_js
import gradio as gr
transformers = await import_transformers_js()
pipeline = transformers.pipeline
pipe = await pipeline('zero-shot-image-classification')
async def classify(image, classes):
data = await pipe(image, classes.split(","))
result = [{item['label']: round(item['score'], 2) for item in data}]
return result
demo = gr.Interface(classify, [gr.Image(label="Input image", type="filepath"), gr.Textbox(label="Classes separated by commas")], gr.Label())
demo.launch()