PrakhAI commited on
Commit
6b89a7e
·
1 Parent(s): 0a7a310

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
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
- img = Image.open(uploaded_file)
46
- st.image(img)
47
- input = jnp.array(tf.cast(tf.image.resize(tf.convert_to_tensor(img), [50, 50]), tf.float32) / 255.)
48
- st.write("Input shape: " + str(input.shape))
49
- st.write("Model Prediction: " + cnn.apply({"params": params}, input))
50
- st.write("Model Prediction type: " + type(cnn.apply({"params": params}, input)))
51
- st.write("Model Prediction type dir: " + dir(cnn.apply({"params": params}, input)))
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,))