LukeStiN commited on
Commit
c0071e1
·
1 Parent(s): 22a016c

without torch

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import streamlit as st
2
 
3
  from PIL import Image
4
- import torch, os
5
 
6
  from transformers import CLIPProcessor, CLIPModel
7
 
@@ -28,6 +28,8 @@ if st.button('Classify', use_container_width=True, type='primary') :
28
  outputs = model(**inputs)
29
  logits_per_image = outputs.logits_per_image # this is the image-text similarity score
30
  probs = logits_per_image.softmax(dim=1) # we can take the softmax to get the label probabilities
31
- indice = torch.argmax(probs).item()
32
 
33
- classes[indice]
 
 
 
1
  import streamlit as st
2
 
3
  from PIL import Image
4
+ # import torch, os
5
 
6
  from transformers import CLIPProcessor, CLIPModel
7
 
 
28
  outputs = model(**inputs)
29
  logits_per_image = outputs.logits_per_image # this is the image-text similarity score
30
  probs = logits_per_image.softmax(dim=1) # we can take the softmax to get the label probabilities
31
+ # indice = torch.argmax().item()
32
 
33
+ # classes[indice]
34
+
35
+ max(probs)