Spaces:
Sleeping
Sleeping
File size: 774 Bytes
2eb30ac 3ae9246 42b2d49 3ae9246 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
from transformers import pipeline
classifier = pipeline("image-classification", model="Pelden/chessdata-model")
import gradio as gr
import numpy as np
# Function to classify images into 6 classes
def image_classifier(inp):
# Dummy classification logic
# Generating random confidence scores for each class
confidence_scores = np.random.rand(6)
# Normalizing confidence scores to sum up to 1
confidence_scores /= np.sum(confidence_scores)
# Creating a dictionary with class labels and corresponding confidence scores
classes = ['Bishop', 'King', 'Knight', 'Pawn', 'Queen', 'Rook']
result = {classes[i]: confidence_scores[i] for i in range(6)}
return result
# Creating Gradio interface
if __name__ == "__main__":
gradio_app.launch() |