KayDee03's picture
Update app.py
a722436 verified
raw
history blame
575 Bytes
from transformers import pipeline
classifier = pipeline("image-classification", model="KayDee03/Fruits-model")
import numpy as np
# Function to classify images into 4 classes
def image_classifier(inp):
confidence_scores = np.random. rand(4)
confidence_scores /= np.sum(confidence_scores)
classes = ['Avocado', 'Banana', 'Guava', 'Mango']
result = {classes[i]: confidence_scores[i] for i in range(4)}
return result
import gradio as gr
# Creating Gradio interface
demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label")
demo. launch()