Spaces:
Runtime error
Runtime error
Commit ·
9c8a691
1
Parent(s): 5f71bd1
Update app.py
Browse files60 unmodified lines6162636465666717 unmodified lines85868788899091929394959697989910010110210310410510660 unmodified linesreturn model.show_misclassified_images(num_images, use_gradcam, gradcam_layer, transparency)description1 = "Test the model's prediction. Currently the model only supports the following classes - plane, car, bird, cat, deer, dog, frog, horse, ship, truck."# Define the full path to the images folder17 unmodified linesinputs=[gr.Image(shape=(32, 32), label="Input Image"),gr.Slider(0, 1, value=0.5, label="Opacity of GradCAM"),gr.Slider(-2, -1, value=-2, step=1, label="Which Layer?"),gr.Slider(1, 10, value=3, step=1, label="How many top confidence classes to be shown?")],outputs=[gr.Label(),gr.Image(shape=(32, 32), label="Model Prediction").style(width=300, height=300)],description=description1,examples=examples)description2 = "Missclassfied Images"# Create a separate interface for the "Misclassified Images" tabmisclassified_interface = gr.Interface(show_misclassified_images_wrapper,inputs=[gr.Number(value=10, label="Number of images to display"),gr.Radio(["Yes", "No"], value="No" , label="Show GradCAM outputs"),gr.Slider(-2, -1, value=-1, step=1, label="Which layer for GradCAM?"),gr.Slider(0, 1, value=0.5, label="Opacity of GradCAM")],outputs=gr.Plot(), description=description2)demo = gr.TabbedInterface([input_interface, misclassified_interface], tab_names=["Input an image", "Misclassified Images"],title="Custom Resnet on CIFAR10 using GradCAM")demo.launch()60 unmodified lines6162636465666717 unmodified lines85868788899091929394959697989910010110210310410510660 unmodified linesreturn model.show_misclassified_images(num_images, use_gradcam, gradcam_layer, transparency)description1 = "Supported Only - plane, car, bird, cat, deer, dog, frog, horse, ship, truck."# Define the full path to the images folder17 unmodified linesinputs=[gr.Image(shape=(32, 32), label="Input Image"),gr.Slider(0, 1, value=0.5, label="Opacity of GradCAM"),gr.Slider(-2, -1, value=-2, step=1, label="Which Layer?"),gr.Slider(1, 10, value=3, step=1, label="How many classes")],outputs=[gr.Label(),gr.Image(shape=(32, 32), label="Predicted Output").style(width=300, height=300)],description=description1,examples=examples)description2 = "Missclassfied Images"# Create a separate interface for the "Misclassified Images" tabmisclassified_interface = gr.Interface(show_misclassified_images_wrapper,inputs=[gr.Number(value=10, label="Number of Images for display"),gr.Radio(["Yes", "No"], value="No" , label="Show GradCAM outputs"),gr.Slider(-2, -1, value=-1, step=1, label="Which layer for GradCAM?"),gr.Slider(0, 1, value=0.5, label="Opacity of GradCAM")],outputs=gr.Plot(), description=description2)demo = gr.TabbedInterface([input_interface, misclassified_interface], tab_names=["Input an image", "Misclassified Images"],title="Gradcam using Cifar10 with CustomResnet Model")demo.launch()
app.py+5-5