PrakhAI commited on
Commit
cab102d
·
1 Parent(s): cd2906a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -43,10 +43,10 @@ if len(uploaded_files) == 0:
43
  st.write("Please upload an image!")
44
  else:
45
  input = jnp.array([tf.cast(tf.image.resize(tf.convert_to_tensor(Image.open(uploaded_file)), [50, 50]), tf.float32) / 255. for uploaded_file in uploaded_files])
46
- prediction = cnn.apply({"params": params}, input)
47
- for (index, image) in enumerate(uploaded_files):
48
  st.image(Image.open(image))
49
- [cat_prob, dog_prob] = jax.nn.softmax(prediction[index])
50
  if cat_prob > dog_prob:
51
  st.write(f"Model Prediction - Cat ({100*cat_prob:.2f}%), Dog ({100*dog_prob:.2f}%)")
52
  else:
 
43
  st.write("Please upload an image!")
44
  else:
45
  input = jnp.array([tf.cast(tf.image.resize(tf.convert_to_tensor(Image.open(uploaded_file)), [50, 50]), tf.float32) / 255. for uploaded_file in uploaded_files])
46
+ predictions = cnn.apply({"params": params}, input)
47
+ for (image, prediction) in zip(uploaded_files, predictions):
48
  st.image(Image.open(image))
49
+ [cat_prob, dog_prob] = jax.nn.softmax(prediction)
50
  if cat_prob > dog_prob:
51
  st.write(f"Model Prediction - Cat ({100*cat_prob:.2f}%), Dog ({100*dog_prob:.2f}%)")
52
  else: