IndexError: too many indices for array: array is 0-dimensional, but 3 were indexed
#1
by
Minjung17
- opened
모델카드를 사용했는데, 에러가 뜹니다.
model = from_pretrained_keras("Derendering/InkSight-Small-p")
cf = model.signatures['serving_default']
image='/content/image2.png'
prompt = "DANKE" # "Recognize and derender." or "Derender the ink:
input_text = tf.constant([prompt], dtype=tf.string)
image_encoded = tf.reshape(tf.io.encode_jpeg(np.array(image)[:, :, :3]), (1, 1))
output = cf(**{'input_text': input_text, 'image/encoded': image_encoded})
IndexError: too many indices for array: array is 0-dimensional, but 3 were indexed 라고요.
Hi Minjung17, thanks for reaching out. The error you're seeing here is because of the usage of InkSight. Please refer to our colab for example. A fix would be:
file_path = '/content/image2.png'
input_image = Image.open(file_path)
image, _, _, _, _ = scale_and_pad(input_image) # this function is defined in the colab as well
prompt = "Recognize and derender."
cf = model.signatures['serving_default']
input_text = tf.constant([prompt], dtype=tf.string)
image_encoded = tf.reshape(tf.io.encode_jpeg(np.array(image)[:, :, :3]), (1, 1))
output = cf(**{'input_text': input_text, 'image/encoded': image_encoded})
Please let me know if this fixes your issue :)
chengkunli
changed discussion status to
closed