Update app.py
Browse files
app.py
CHANGED
@@ -41,14 +41,14 @@ uploaded_files = st.file_uploader("Input images of cats or dogs (examples in fil
|
|
41 |
if len(uploaded_files) == 0:
|
42 |
st.write("Please upload an image!")
|
43 |
else:
|
44 |
-
for uploaded_file in uploaded_files
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
st.
|
52 |
|
53 |
def gridify(kernel, grid, kernel_size, scaling=5, padding=1):
|
54 |
scaled_and_padded = np.pad(np.repeat(np.repeat(kernel, repeats=scaling, axis=0), repeats=scaling, axis=1), ((padding,),(padding,),(0,),(0,)), 'constant', constant_values=(-1,))
|
|
|
41 |
if len(uploaded_files) == 0:
|
42 |
st.write("Please upload an image!")
|
43 |
else:
|
44 |
+
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])
|
45 |
+
st.write("Input shape: " + str(input.shape))
|
46 |
+
pred = cnn.apply({"params": params}, input)
|
47 |
+
st.write("Model Prediction: " + str(pred))
|
48 |
+
st.write("Model Prediction type: " + str(type(pred)))
|
49 |
+
st.write("Model Prediction type dir: " + str(dir(pred)))
|
50 |
+
for (index, image) in enumerate(uploaded_files):
|
51 |
+
st.image(Image.open(image))
|
52 |
|
53 |
def gridify(kernel, grid, kernel_size, scaling=5, padding=1):
|
54 |
scaled_and_padded = np.pad(np.repeat(np.repeat(kernel, repeats=scaling, axis=0), repeats=scaling, axis=1), ((padding,),(padding,),(0,),(0,)), 'constant', constant_values=(-1,))
|