starpreeda commited on
Commit
b2dd653
·
verified ·
1 Parent(s): c269260

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +4 -1
README.md CHANGED
@@ -114,6 +114,7 @@ Input (224, 224, 3)
114
  ↳ Dropout(0.4)
115
  ↳ Dense(4, activation='softmax')
116
  ---
 
117
  ## 🚀 How to Load and Use
118
 
119
  import os
@@ -125,13 +126,14 @@ from tensorflow.keras.applications import EfficientNetB0
125
  from tensorflow.keras.layers import Dense, GlobalAveragePooling2D, Dropout, BatchNormalization
126
  from tensorflow.keras.models import Model
127
 
128
- model_url = "https://huggingface.co/starpreeda/BrainTumorTest/resolve/main/efficientnetb0_finetuned_brain_mri.keras"
129
  weights_path = "model_weights.keras"
130
 
131
  if not os.path.exists(weights_path):
132
  print("Downloading model weights...")
133
  urllib.request.urlretrieve(model_url, weights_path)
134
  print("Download completed!")
 
135
  base_model = EfficientNetB0(weights=None, include_top=False, input_shape=(224, 224, 3))
136
  x = base_model.output
137
  x = GlobalAveragePooling2D()(x)
@@ -139,6 +141,7 @@ x = BatchNormalization()(x)
139
  x = Dense(256, activation='relu')(x)
140
  x = Dropout(0.4)(x)
141
  outputs = Dense(4, activation='softmax')(x)
 
142
  model = Model(inputs=base_model.input, outputs=outputs)
143
  model.load_weights(weights_path)
144
  print("Model is ready for use!")
 
114
  ↳ Dropout(0.4)
115
  ↳ Dense(4, activation='softmax')
116
  ---
117
+ ```
118
  ## 🚀 How to Load and Use
119
 
120
  import os
 
126
  from tensorflow.keras.layers import Dense, GlobalAveragePooling2D, Dropout, BatchNormalization
127
  from tensorflow.keras.models import Model
128
 
129
+ model_url = "[https://huggingface.co/starpreeda/BrainTumorTest/resolve/main/efficientnetb0_finetuned_brain_mri.keras](https://huggingface.co/starpreeda/BrainTumorTest/resolve/main/efficientnetb0_finetuned_brain_mri.keras)"
130
  weights_path = "model_weights.keras"
131
 
132
  if not os.path.exists(weights_path):
133
  print("Downloading model weights...")
134
  urllib.request.urlretrieve(model_url, weights_path)
135
  print("Download completed!")
136
+
137
  base_model = EfficientNetB0(weights=None, include_top=False, input_shape=(224, 224, 3))
138
  x = base_model.output
139
  x = GlobalAveragePooling2D()(x)
 
141
  x = Dense(256, activation='relu')(x)
142
  x = Dropout(0.4)(x)
143
  outputs = Dense(4, activation='softmax')(x)
144
+
145
  model = Model(inputs=base_model.input, outputs=outputs)
146
  model.load_weights(weights_path)
147
  print("Model is ready for use!")