Instructions to use Derendering/InkSight-Small-p with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TF-Keras
How to use Derendering/InkSight-Small-p with TF-Keras:
# Note: 'keras<3.x' or 'tf_keras' must be installed (legacy) # See https://github.com/keras-team/tf-keras for more details. from huggingface_hub import from_pretrained_keras model = from_pretrained_keras("Derendering/InkSight-Small-p") - Notebooks
- Google Colab
- Kaggle
IndexError: too many indices for array: array is 0-dimensional, but 3 were indexed
모델카드를 사용했는데, 에러가 뜹니다.
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 :)