Spaces:
Running
Running
load weights error solved
Browse files
__pycache__/model.cpython-38.pyc
ADDED
Binary file (8.92 kB). View file
|
|
app.py
CHANGED
@@ -13,10 +13,10 @@ caption_model = get_model()
|
|
13 |
|
14 |
img_url = st.text_input(label='Enter Image URL')
|
15 |
|
16 |
-
if (img_url != "")
|
17 |
img = Image.open(requests.get(img_url, stream=True).raw)
|
18 |
st.image(img)
|
19 |
|
20 |
-
img
|
21 |
-
pred_caption = generate_caption(
|
22 |
st.write(pred_caption)
|
|
|
13 |
|
14 |
img_url = st.text_input(label='Enter Image URL')
|
15 |
|
16 |
+
if (img_url != "") and (img_url != None):
|
17 |
img = Image.open(requests.get(img_url, stream=True).raw)
|
18 |
st.image(img)
|
19 |
|
20 |
+
img.save('tmp.jpg')
|
21 |
+
pred_caption = generate_caption('tmp.jpg', caption_model)
|
22 |
st.write(pred_caption)
|
model.py
CHANGED
@@ -318,6 +318,6 @@ def get_caption_model():
|
|
318 |
sample_enc_out = caption_model.encoder(sample_img_embed, training=False)
|
319 |
caption_model.decoder(sample_y, sample_enc_out, training=False)
|
320 |
|
321 |
-
caption_model.load_weights('saved_models\
|
322 |
|
323 |
return caption_model
|
|
|
318 |
sample_enc_out = caption_model.encoder(sample_img_embed, training=False)
|
319 |
caption_model.decoder(sample_y, sample_enc_out, training=False)
|
320 |
|
321 |
+
caption_model.load_weights(r'saved_models\image_captioning_transformer_weights_1.h5')
|
322 |
|
323 |
return caption_model
|
saved_models/{image_captioning_transformer_weights.h5 β image_captioning_transformer_weights_1.h5}
RENAMED
File without changes
|
saved_models/{model.h5 β image_captioning_transformer_weights_2.h5}
RENAMED
File without changes
|
tmp.jpg
ADDED