Update app.py
Browse files20 unmodified lines2122232425262728297 unmodified lines3738394041424344454620 unmodified lines])def predict(img):# img = img.convert("RGB")# img = tfm(img)# img = img[np.newaxis, :]# # # with torch.no_grad():# # # pred_prob = model(img)7 unmodified lines# # # print(f"Model prediction {pred}, hence Not Santa")# # # print("========================================================")return {'santa': 0.1, 'not-a-santa': 0.6}# gr.Interface(fn=predict, inputs="image", outputs="label").launch()demo = gr.Interface(fn=predict, inputs="image", outputs="label")demo.launch()20 unmodified lines2122232425262728297 unmodified lines37383940414220 unmodified lines])def predict(img):img = img.convert("RGB")img = tfm(img)img = img[np.newaxis, :]# # # with torch.no_grad():# # # pred_prob = model(img)7 unmodified lines# # # print(f"Model prediction {pred}, hence Not Santa")# # # print("========================================================")return {'santa': 0.2, 'not-a-santa': 0.3}gr.Interface(fn=predict, inputs=gr.Image(type="pil"), outputs="label").launch(debug=True)
app.py+5-9