Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,8 +10,8 @@ from model import generate2,ClipCaptionModel
|
|
| 10 |
from engine import inference
|
| 11 |
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
image_processor = ViTImageProcessor.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
| 16 |
tokenizer = GPT2TokenizerFast.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
| 17 |
|
|
@@ -44,12 +44,12 @@ model = model.eval()
|
|
| 44 |
|
| 45 |
coco_model = ClipCaptionModel(prefix_length)
|
| 46 |
coco_model.load_state_dict(torch.load('COCO_model.h5',map_location=torch.device('cpu')))
|
| 47 |
-
model = model.eval()
|
| 48 |
|
| 49 |
|
| 50 |
def ui():
|
| 51 |
st.markdown("# Image Captioning")
|
| 52 |
-
# st.markdown("## Done By- Vageesh
|
| 53 |
uploaded_file = st.file_uploader("Upload an Image", type=['png', 'jpeg', 'jpg'])
|
| 54 |
|
| 55 |
if uploaded_file is not None:
|
|
|
|
| 10 |
from engine import inference
|
| 11 |
|
| 12 |
|
| 13 |
+
model_trained = VisionEncoderDecoderModel.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
| 14 |
+
model_trained.load_state_dict(torch.load('model_trained.pth',map_location=torch.device('cpu')))
|
| 15 |
image_processor = ViTImageProcessor.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
| 16 |
tokenizer = GPT2TokenizerFast.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
| 17 |
|
|
|
|
| 44 |
|
| 45 |
coco_model = ClipCaptionModel(prefix_length)
|
| 46 |
coco_model.load_state_dict(torch.load('COCO_model.h5',map_location=torch.device('cpu')))
|
| 47 |
+
# model = model.eval()
|
| 48 |
|
| 49 |
|
| 50 |
def ui():
|
| 51 |
st.markdown("# Image Captioning")
|
| 52 |
+
# st.markdown("## Done By- Vageesh and Rushil")
|
| 53 |
uploaded_file = st.file_uploader("Upload an Image", type=['png', 'jpeg', 'jpg'])
|
| 54 |
|
| 55 |
if uploaded_file is not None:
|