PranomVignesh's picture
Update app.py
fb78c6b
raw
history blame contribute delete
925 Bytes
# gr.Interface.load("models/PranomVignesh/Handwritten-Characters").launch()
import gradio as gr
from transformers import pipeline
from PIL import Image
imageClassifier = pipeline(task="image-classification",
model="PranomVignesh/Handwritten-Characters")
def predict(image):
image = Image.fromarray(image)
predictions = imageClassifier(image)
output = {}
for item in predictions:
output[item['label']] = item['score']
return output
inputs = gr.Sketchpad(shape=(224, 224),
live=True,
label="Draw your characters to detect")
outputs = gr.Label(label="Predicted Character")
interface = gr.Interface(
fn=predict,
inputs=inputs,
outputs=outputs,
# title=title,
# examples=examples,
# description=description,
# cache_examples=True,
theme='huggingface'
)
interface.launch(debug=True, enable_queue=True)