dnth commited on
Commit
94cb611
1 Parent(s): 38e6bcc

add sample images and webpage

Browse files
Files changed (2) hide show
  1. app.py +12 -1
  2. requirements.txt +0 -1
app.py CHANGED
@@ -40,6 +40,17 @@ learn = model_type.fastai.learner(dls=[train_dl, valid_dl], model=model, metrics
40
 
41
  learn = learn.load('model')
42
 
 
 
 
 
 
 
 
 
 
 
 
43
  def show_preds(input_image, display_label, display_bbox, detection_threshold):
44
 
45
  if detection_threshold==0: detection_threshold=0.5
@@ -61,7 +72,7 @@ detection_threshold_slider = gr.inputs.Slider(minimum=0, maximum=1, step=0.1, de
61
  outputs = gr.outputs.Image(type="pil")
62
 
63
  # Option 1: Get an image from local drive
64
- gr_interface = gr.Interface(fn=show_preds, inputs=["image", display_chkbox_label, display_chkbox_box, detection_threshold_slider], outputs=outputs, title='IceApp - Fridge Object')
65
 
66
  # # Option 2: Grab an image from a webcam
67
  # gr_interface = gr.Interface(fn=show_preds, inputs=["webcam", display_chkbox_label, display_chkbox_box, detection_threshold_slider], outputs=outputs, title='IceApp - COCO', live=False)
 
40
 
41
  learn = learn.load('model')
42
 
43
+ import os
44
+ for root, dirs, files in os.walk(r'sample_images/'):
45
+ for filename in files:
46
+ print(filename)
47
+
48
+ examples = ["sample_images/"+file for file in files]
49
+ article="<p style='text-align: center'><a href='https://dicksonneoh.com/fridge-detector/' target='_blank'>Blog post</a></p>"
50
+ enable_queue=True
51
+
52
+
53
+
54
  def show_preds(input_image, display_label, display_bbox, detection_threshold):
55
 
56
  if detection_threshold==0: detection_threshold=0.5
 
72
  outputs = gr.outputs.Image(type="pil")
73
 
74
  # Option 1: Get an image from local drive
75
+ gr_interface = gr.Interface(fn=show_preds, inputs=["image", display_chkbox_label, display_chkbox_box, detection_threshold_slider], outputs=outputs, title='IceApp - Fridge Object', article=article,examples=examples)
76
 
77
  # # Option 2: Grab an image from a webcam
78
  # gr_interface = gr.Interface(fn=show_preds, inputs=["webcam", display_chkbox_label, display_chkbox_box, detection_threshold_slider], outputs=outputs, title='IceApp - COCO', live=False)
requirements.txt CHANGED
@@ -4,6 +4,5 @@
4
 
5
  git+https://github.com/dnth/icevision.git
6
  icedata
7
-
8
  #fastai
9
  #scikit-image
 
4
 
5
  git+https://github.com/dnth/icevision.git
6
  icedata
 
7
  #fastai
8
  #scikit-image