Vageesh1 rushil78 commited on
Commit
7f328f8
1 Parent(s): f391387

Update app.py (#1)

Browse files

- Update app.py (2c18242cade832c0294d96d9a62aabb7a09e96f9)


Co-authored-by: Rushil shah <rushil78@users.noreply.huggingface.co>

Files changed (1) hide show
  1. app.py +6 -6
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
- 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
 
 
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