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 |
-
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 |
|
|
@@ -72,10 +72,10 @@ def ui():
|
|
| 72 |
st.image(uploaded_file, width = 500, channels = 'RGB')
|
| 73 |
st.markdown("**PREDICTION:** " + out)
|
| 74 |
|
| 75 |
-
elif option=='VIT+GPT2':
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
|
| 80 |
|
| 81 |
|
|
|
|
| 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 |
|
|
|
|
| 72 |
st.image(uploaded_file, width = 500, channels = 'RGB')
|
| 73 |
st.markdown("**PREDICTION:** " + out)
|
| 74 |
|
| 75 |
+
# elif option=='VIT+GPT2':
|
| 76 |
+
# out=show_n_generate(uploaded_file, greedy = False, model = model_trained)
|
| 77 |
+
# st.image(uploaded_file, width = 500, channels = 'RGB')
|
| 78 |
+
# st.markdown("**PREDICTION:** " + out)
|
| 79 |
|
| 80 |
|
| 81 |
|