Spaces:
Runtime error
Runtime error
File size: 567 Bytes
20abfd4 bbbad16 20abfd4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
from transformers import pipeline
classifier = pipeline("image-classification", model="Kapu13/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()
|