import gradio as gr from fastai.vision.all import * import skimage # Load the model learn = load_learner('export.pkl') # Get labels labels = learn.dls.vocab # Prediction function def predict(img): img = PILImage.create(img) pred, pred_idx, probs = learn.predict(img) prediction = str(pred) return prediction # App configuration title = "Breast cancer detection with Deep Transfer Learning(ResNet18)." description = """

As a radiologist or oncologist, it is crucial to know what is wrong with a breast x-ray image.
Upload the breast X-ray image to know what is wrong with a patient's breast with or without implant.
This product is from the findings of my (Team) published research paper: read paper.
Learn more about me: Fosberg Addai

""" article = "

Web app is built and managed by Addai Fosberg

" examples = ['img1.jpeg', 'img2.jpeg'] enable_queue = True # Update the interface components gr.Interface( fn=predict, inputs=gr.Image(shape=(512, 512)), # Updated input component outputs=gr.Label(num_top_classes=3), # Updated output component title=title, description=description, article=article, examples=examples, enable_queue=enable_queue ).launch()