sanjanatule commited on
Commit
5a17a36
·
1 Parent(s): cb660dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -85,17 +85,16 @@ classes = ('plane', 'car', 'bird', 'cat', 'deer',
85
 
86
  def inference(input_img, see_misclassified=False,num_misclassified_imgs=0,see_gradcam=False,num_gradcam_imgs=0,transparency = 0.85, target_layer_number = -1,top_classes=3):
87
 
88
- # if see_misclassified: # show misclassified images
89
- # org_img = cv2.imread('/content/drive/MyDrive/AI/ERA_course/session12/example_images/img_eg_0.jpg')
90
- # input_img = org_img
91
 
92
- # elif num_gradcam_imgs > 0: # show gradcam on example images
93
- # org_img = cv2.imread('/content/drive/MyDrive/AI/ERA_course/session12/example_images/img_eg_0.jpg')
94
- # input_img = org_img
95
 
96
- # else: # nothing chosen - misclassified or gradcam
97
-
98
- org_img = input_img
99
 
100
  # model inference
101
  transform = transforms.ToTensor()
@@ -139,4 +138,4 @@ demo = gr.Interface(
139
  description = description,
140
  examples = examples)
141
 
142
- demo.launch()
 
85
 
86
  def inference(input_img, see_misclassified=False,num_misclassified_imgs=0,see_gradcam=False,num_gradcam_imgs=0,transparency = 0.85, target_layer_number = -1,top_classes=3):
87
 
88
+ if see_misclassified: # show misclassified images
89
+ org_img = np.asarray(Image.open('img_eg_0.jpg'))
90
+ input_img = org_img
91
 
92
+ elif num_gradcam_imgs > 0: # show gradcam on example images
93
+ org_img = np.asarray(Image.open('img_eg_0.jpg'))
94
+ input_img = org_img
95
 
96
+ else: # nothing chosen - misclassified or gradcam
97
+ org_img = input_img
 
98
 
99
  # model inference
100
  transform = transforms.ToTensor()
 
138
  description = description,
139
  examples = examples)
140
 
141
+ demo.launch(default=True)