nielsr HF staff commited on
Commit
248dc7c
1 Parent(s): db36c09

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -6,10 +6,10 @@ feature_extractor = AutoFeatureExtractor.from_pretrained("microsoft/dit-base-fin
6
  model = AutoModelForImageClassification.from_pretrained("microsoft/dit-base-finetuned-rvlcdip")
7
 
8
  def classify_image(image):
9
- pixel_values = feature_extractor(image, return_tensors="pt")
10
 
11
  with torch.no_grad():
12
- outputs = model(pixel_values)
13
  logits = outputs.logits
14
 
15
  predicted_class = model.config.id2label[logits.argmax(-1).item()]
 
6
  model = AutoModelForImageClassification.from_pretrained("microsoft/dit-base-finetuned-rvlcdip")
7
 
8
  def classify_image(image):
9
+ encoding = feature_extractor(image, return_tensors="pt")
10
 
11
  with torch.no_grad():
12
+ outputs = model(**encoding)
13
  logits = outputs.logits
14
 
15
  predicted_class = model.config.id2label[logits.argmax(-1).item()]