Download model.py from viveksardey/PneumoniaDetectionPredictionBackend: direct link, hf CLI and curl.
- Browser
- Download file 555 Bytes
-
https://huggingface.co/spaces/viveksardey/PneumoniaDetectionPredictionBackend/resolve/main/model.py
- Command line
-
hf download hf://spaces/viveksardey/PneumoniaDetectionPredictionBackend/model.py
-
curl -L -o model.py https://huggingface.co/spaces/viveksardey/PneumoniaDetectionPredictionBackend/resolve/main/model.py
555 Bytes
| import tensorflow as tf | |
| from tensorflow.keras.applications import ResNet50 | |
| from tensorflow.keras.layers import GlobalAveragePooling2D, Dense | |
| from tensorflow.keras.models import Model | |
| def build_model(): | |
| base_model = ResNet50( | |
| weights="imagenet", | |
| include_top=False, | |
| input_shape=(224,224,3) | |
| ) | |
| x = base_model.output | |
| x = GlobalAveragePooling2D()(x) | |
| x = Dense(256, activation="relu")(x) | |
| output = Dense(1, activation="sigmoid")(x) | |
| model = Model(inputs=base_model.input, outputs=output) | |
| return model | |