import gradio as gr import base64 from fastai.vision.all import * learn=load_learner('export.pkl') labels = learn.dls.vocab def predict(img): img = PILImage.create(img) pred,pred_idx,probs = learn.predict(img) return {labels[i]: float(probs[i]) for i in range(len(labels))} # Read the image file and encode it as base64 with open("./1001epochs.png", "rb") as f: image_data = f.read() image_base64 = base64.b64encode(image_data).decode("utf-8") allow_flagging = "never" title = f"""

Emergency Vehicle Classifier

""" description = f"""

Simply upload a photo and let our sophisticated AI system determine the specific type of emergency vehicle depicted.

Disclaimer: The purpose of this application is solely for demonstration. 1001epochs does not claim ownership for the results. Contact: contact@1001epochs.co.uk for full solution.

""" interpretation='default' gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3), title=title, interpretation=interpretation, description=description).launch()