Spaces:
Sleeping
Sleeping
from transformers import pipeline | |
import gradio as gr | |
import numpy as np | |
# Function to classify images into 7 classes | |
def image_classifier(inp): | |
confidence_scores = np.random.rand(5) | |
confidence_scores /= np.sum(confidence_scores) | |
classes = ['crocus', 'daffodil', 'daisy', 'dandelion', 'fritillary'] | |
result = {classes[i]: confidence_scores[i] for i in range(5)} | |
return result | |
# Creating Gradio interface | |
demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label") | |
demo.launch(share=True) |