mirror of https://github.com/ChillFish8/lust.git
Add python examples
This commit is contained in:
parent
4846d75d23
commit
6e5871389c
|
@ -1,2 +1,3 @@
|
|||
/data
|
||||
/target
|
||||
/venv
|
|
@ -0,0 +1,21 @@
|
|||
import requests
|
||||
|
||||
with open("./example.jpeg", "rb") as file:
|
||||
image = file.read()
|
||||
|
||||
r = requests.post(
|
||||
"http://127.0.0.1:8000/v1/user-profiles",
|
||||
params={"format": "jpeg"},
|
||||
headers={
|
||||
"content-length": str(len(image)),
|
||||
"content-type": "application/octet-stream"
|
||||
},
|
||||
data=image,
|
||||
)
|
||||
|
||||
r.raise_for_status()
|
||||
data = r.json()
|
||||
|
||||
print("My image id: {}", data['image_id'])
|
||||
print("It took {}s to complete!", data['processing_time'])
|
||||
print("And has a checksum of {}!", data['checksum'])
|
Loading…
Reference in New Issue