ganesh1410 commited on
Commit
0b4dbd3
1 Parent(s): 183eff9

feat: add examples

Browse files
Files changed (3) hide show
  1. app.py +2 -2
  2. examples/cat-1.jpg +0 -0
  3. examples/dog-1.jpg +0 -0
app.py CHANGED
@@ -38,7 +38,7 @@ if __name__ == '__main__':
38
  def predict(image):
39
  img = PILImage.create(image)
40
  pred,pred_idx,probs = model.predict(img)
41
- return f"Probability it's a cat: {probs[1].item():.6f}"
42
 
43
- demo = gr.Interface(fn=model.predict, inputs="image", outputs='text')
44
  demo.launch()
 
38
  def predict(image):
39
  img = PILImage.create(image)
40
  pred,pred_idx,probs = model.predict(img)
41
+ return {'Cat':probs[1].item(), 'Not Cat':probs[0].item()}
42
 
43
+ demo = gr.Interface(fn=model.predict, inputs="image", outputs=['label'],examples=['examples/cat-1.jpg','examples/dog-1.jpg'],allow_flagging='never')
44
  demo.launch()
examples/cat-1.jpg ADDED
examples/dog-1.jpg ADDED