import requests import gradio as gr from transformers import pipeline # make the image classification pipeline def classify_image(test_sample): img_class= pipeline( "image-classification", model="AMfeta99/vit-base-oxford-brain-tumor" ) results = img_class(our_dataset['test']['image'][0]) max_score_result = max(results, key=lambda x: x['score']) predictions = max_score_result['label'] return predictions image = gr.Image() label = gr.Label(num_top_classes=1) title = "Brain Tumor X-ray Classification" description="Worried about whether your brain scan is normal or not? Upload your x-ray and the algorithm will give you an expert opinion. Check out [the original algorithm](https://huggingface.co/AMfeta99/vit-base-oxford-brain-tumor) that this demo is based off of." article="

Image Classification | Demo Model

" demo = gr.Interface(fn=classify_image, inputs=image , outputs=label, description=description,article=article,title=title) demo.launch(share=True)