import gradio as gr | |
from glob import glob | |
from PIL import Image | |
from explain import get_results, reproduce | |
def classify_and_explain(image): | |
reproduce() | |
# This function will classify the image and return a list of image paths | |
list_of_images = get_results(img_for_testing=image) | |
return list_of_images | |
def get_examples(): | |
return [Image.open(i) for i in glob("samples/*")] | |
demo = gr.Interface( | |
fn=classify_and_explain, inputs="image", outputs="gallery", examples=get_examples() | |
) | |
demo.launch() | |