refactoring
This commit is contained in:
@@ -56,18 +56,23 @@ def decode_batch_predictions(pred):
|
|||||||
output_text.append(res)
|
output_text.append(res)
|
||||||
return output_text
|
return output_text
|
||||||
|
|
||||||
def load_model():
|
model = None
|
||||||
_model = keras.models.load_model('model')
|
def _getModel():
|
||||||
model = keras.models.Model(
|
global model
|
||||||
_model.get_layer(name="image").input,
|
if model is None:
|
||||||
_model.get_layer(name="dense2").output)
|
|
||||||
return model
|
|
||||||
|
|
||||||
def getTextInCaptchaImage(captchaImageFile):
|
|
||||||
batchImages = encode_single_sample(captchaImageFile)
|
|
||||||
preds = model.predict(batchImages)
|
|
||||||
return decode_batch_predictions(preds)[0]
|
|
||||||
|
|
||||||
print("loading model...")
|
print("loading model...")
|
||||||
model = load_model()
|
model = load_model()
|
||||||
model.summary()
|
model.summary()
|
||||||
|
return model
|
||||||
|
|
||||||
|
def load_model():
|
||||||
|
_model = keras.models.load_model('model')
|
||||||
|
__model = keras.models.Model(
|
||||||
|
_model.get_layer(name="image").input,
|
||||||
|
_model.get_layer(name="dense2").output)
|
||||||
|
return __model
|
||||||
|
|
||||||
|
def getTextInCaptchaImage(captchaImageFile):
|
||||||
|
batchImages = encode_single_sample(captchaImageFile)
|
||||||
|
preds = _getModel().predict(batchImages)
|
||||||
|
return decode_batch_predictions(preds)[0]
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"updateVAERSFiles(\n",
|
"updateVAERSFiles(\n",
|
||||||
" needsUpdate,\n",
|
" needsUpdate = needsUpdate,\n",
|
||||||
" years = [2022],\n",
|
" years = [2022],\n",
|
||||||
" workingDirectory = getWorkingDirectory())"
|
" workingDirectory = getWorkingDirectory())"
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user