Update app.py
Browse files
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 |
-
|
47 |
-
for (
|
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:
|
|
|
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:
|