Spaces:
Sleeping
Sleeping
File size: 782 Bytes
fe53ce2 6935c2f 139ed0e fe53ce2 139ed0e d1625ff 6935c2f d1625ff 6935c2f d1625ff 0114d4f 139ed0e 6935c2f 40afe72 a3dc363 6935c2f 111f215 139ed0e |
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 |
import gradio as gr
from transformers import pipeline
from huggingface_hub import hf_api
from huggingface_hub import DatasetFilter, ModelFilter
api = hf_api.HfApi()
flyswot_models = ModelFilter(author="flyswot")
models = api.list_models(filter=flyswot_models)
models = [model.modelId for model in models]
#choices = gr.inputs.Dropdown(choices=models, default='flyswot/convnext-tiny-224_flyswot',label="Model")
pipe = pipeline("image-classification", model="flyswot/convnext-tiny-224_flyswot")
def predict(image):
predictions = pipe(image, top_k=20)
return {pred['label']: pred['score'] for pred in predictions}
iface = gr.Interface(
fn=predict,
inputs=gr.inputs.Image(type='filepath'),
outputs='label', interpretation='default')
iface.launch(enable_queue=True)
|