import numpy as np | |
def image_classifier(inp): | |
confidence_scores = np.random.rand(3) | |
confidence_scores /= np.sum(confidence_scores) | |
classes = ['King', 'Knight', 'Queen'] | |
result = {classes[i] : confidence_scores[i] for i in range(3)} | |
return result | |
import gradio as gr | |
demo = gr.Interface(fn = image_classifier, inputs="image", outputs="label") | |
demo.launch() |