model_explorer / app.py
davanstrien's picture
davanstrien HF staff
Update app.py
7662a0c
raw
history blame
423 Bytes
import gradio as gr
from transformers import pipeline
pipe = pipeline("image-classification", model="flyswot/convnext-tiny-224_flyswot")
def predict(image):
predictions = pipe(image)
return {pred['label']: pred['score'] for pred in predictions}
iface = gr.Interface(
fn=predict,
inputs=gr.inputs.Image(type='filepath'),
outputs='label', interpretation='shap',num_shap=2, theme="huggingface")
iface.launch()