WpythonW commited on
Commit
a5c16e4
·
verified ·
1 Parent(s): b297c91

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -1
README.md CHANGED
@@ -2,4 +2,28 @@
2
  license: apache-2.0
3
  base_model:
4
  - facebook/dinov2-with-registers-small
5
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: apache-2.0
3
  base_model:
4
  - facebook/dinov2-with-registers-small
5
+ ---
6
+
7
+ ### Example
8
+ # Load model directly
9
+ ```python
10
+ from transformers import AutoImageProcessor, Dinov2WithRegistersForImageClassification
11
+ import torch
12
+ import numpy as np
13
+ from PIL import Image
14
+ import os
15
+ import pandas as pd
16
+
17
+ image_processor = AutoImageProcessor.from_pretrained('WpythonW/dinoV2-deepfake-detector')
18
+ model = Dinov2WithRegistersForImageClassification.from_pretrained("WpythonW/dinoV2-deepfake-detector")
19
+ model.config.id2label = {0: "FAKE", 1: "REAL"}
20
+ model.config.label2id = {"FAKE": 0, "REAL": 1}
21
+
22
+ real = Image.open('real.jpg')
23
+ fake = Image.open('fake1.png')
24
+
25
+ inputs = image_processor([real, fake], return_tensors="pt")
26
+
27
+ with torch.no_grad():
28
+ logits = model(**inputs).logits
29
+ ```