import gradio as gr from fastai.vision.all import * import skimage learn = load_learner('model.pkl') def predict(img): img = PILImage.create(img) return round(learn.predict(img)[0][0]) title = "Number of characters in a single line image" description = "Counts the number of characters including special characters in a text present in image. This is a precursor to building a different kind of OCR(experimental approach) with CNN + RNN." examples = ["1.png", "2.png", "3.png", "4.png"] interpretation = 'default' enable_queue = True gr.Interface(fn=predict, inputs=gr.inputs.Image(), outputs=gr.outputs.Textbox(label='Predicted Score'),title=title, description=description, examples=examples,interpretation=interpretation, enable_queue=enable_queue, live=True).launch()