File size: 589 Bytes
8798e5f
 
 
 
 
 
 
 
fd7b2b7
8798e5f
fd7b2b7
8798e5f
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import requests
import base64
import sys

def detect_api(filename):
    b64 = base64.b64encode(open(sys.argv[1], 'rb').read()).decode('utf8')
    data = dict(image = b64)
    response = requests.post('https://bzh.imatag.com/bzh/api/v1.0/detect',
                             headers={'X-Api-Key': 'e80069e02b767fdca459c42fcc5577ab'},
                             json=data)
    response.raise_for_status()
    if response.json()['p-value'] < 1e-3:
        print("watermark detected")
    else:
        print("no watermark detected")

if __name__ == '__main__':
    detect_api(sys.argv[1])