bvd757 commited on
Commit
5f121fa
·
1 Parent(s): 1751037
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -128,7 +128,6 @@ def load_model(test=False):
128
  model.load_state_dict(torch.load(f"{path}/full_model_v4.pth", map_location=device))
129
  if test:
130
  print(device)
131
- print(model)
132
  print("Model!!!")
133
  text = 'We propose an architecture for VQA which utilizes recurrent layers to\ngenerate visual and textual attention. The memory characteristic of the\nproposed recurrent attention units offers a rich joint embedding of visual and\ntextual features and enables the model to reason relations between several\nparts of the image and question. Our single model outperforms the first place\nwinner on the VQA 1.0 dataset, performs within margin to the current\nstate-of-the-art ensemble model. We also experiment with replacing attention\nmechanisms in other state-of-the-art models with our implementation and show\nincreased accuracy. In both cases, our recurrent attention mechanism improves\nperformance in tasks requiring sequential or relational reasoning on the VQA\ndataset.'
134
  print(get_themes(text, model, tokenizer, label_to_theme, device))
@@ -149,7 +148,7 @@ def kek():
149
  model, tokenizer, label_to_theme, device = load_model()
150
 
151
  with st.spinner("Classifying..."):
152
- themes = get_themes(text, model, tokenizer, label_to_theme, device, lim)
153
 
154
  st.success("Classification results:")
155
  for theme, prob in themes:
 
128
  model.load_state_dict(torch.load(f"{path}/full_model_v4.pth", map_location=device))
129
  if test:
130
  print(device)
 
131
  print("Model!!!")
132
  text = 'We propose an architecture for VQA which utilizes recurrent layers to\ngenerate visual and textual attention. The memory characteristic of the\nproposed recurrent attention units offers a rich joint embedding of visual and\ntextual features and enables the model to reason relations between several\nparts of the image and question. Our single model outperforms the first place\nwinner on the VQA 1.0 dataset, performs within margin to the current\nstate-of-the-art ensemble model. We also experiment with replacing attention\nmechanisms in other state-of-the-art models with our implementation and show\nincreased accuracy. In both cases, our recurrent attention mechanism improves\nperformance in tasks requiring sequential or relational reasoning on the VQA\ndataset.'
133
  print(get_themes(text, model, tokenizer, label_to_theme, device))
 
148
  model, tokenizer, label_to_theme, device = load_model()
149
 
150
  with st.spinner("Classifying..."):
151
+ themes = get_themes(text, model, tokenizer, label_to_theme, device, 5)
152
 
153
  st.success("Classification results:")
154
  for theme, prob in themes: