arham061 commited on
Commit
d39566a
1 Parent(s): 2a57eb8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -21,9 +21,16 @@ def classify_images(img):
21
  pred, idx, probs = learn.predict(img)
22
  return dict(zip(categories, map(float, probs)))
23
 
 
 
 
 
 
 
 
24
  image = gr.inputs.Image(shape=(192,192))
25
  label = gr.outputs.Label()
26
  examples = ['rock.jpg', 'paper.jpg', 'scissor.jpg']
27
 
28
  intf = gr.Interface(fn = classify_images, inputs = image, outputs = label, examples = examples)
29
- intf.launch(inline=False)
 
21
  pred, idx, probs = learn.predict(img)
22
  return dict(zip(categories, map(float, probs)))
23
 
24
+ def get_webcam_image():
25
+ cap = cv2.VideoCapture(0)
26
+ _, frame = cap.read()
27
+ cap.release()
28
+ return frame
29
+
30
+
31
  image = gr.inputs.Image(shape=(192,192))
32
  label = gr.outputs.Label()
33
  examples = ['rock.jpg', 'paper.jpg', 'scissor.jpg']
34
 
35
  intf = gr.Interface(fn = classify_images, inputs = image, outputs = label, examples = examples)
36
+ intf.launch(inline=False, capture_interface=True, capture_fn=get_webcam_image)