Spaces:
Build error
Build error
Download cnn.py from maverick1729/image_captioning: direct link, hf CLI and curl.
- Browser
- Download file 398 Bytes
-
https://huggingface.co/spaces/maverick1729/image_captioning/resolve/main/cnn.py
- Command line
-
hf download hf://spaces/maverick1729/image_captioning/cnn.py
-
curl -L -o cnn.py https://huggingface.co/spaces/maverick1729/image_captioning/resolve/main/cnn.py
398 Bytes
| import tensorflow as tf | |
| def CNN_encoder(): | |
| base_model = tf.keras.applications.EfficientNetB0( | |
| include_top=False, | |
| weights='imagenet' | |
| ) | |
| base_model.trainable = False | |
| output = base_model.output | |
| output = tf.keras.layers.Reshape((-1, output.shape[-1]))(output) | |
| cnn_model = tf.keras.models.Model(base_model.input, output) | |
| return cnn_model |