Give parameter a better name: image

This commit is contained in:
niten 2023-01-09 10:29:03 -08:00
parent d97d1205b4
commit 35cc4221a1
1 changed files with 3 additions and 3 deletions

View File

@ -110,14 +110,14 @@ def result_to_dict(res, base_url):
# return result_to_dict(result, base_url)
@app.post("/images")
def analyze_image(request: Request, incoming_data: bytes = File()):
def analyze_image(request: Request, image: bytes = File()):
print("Initiating file receipt, url: " + str(request.url))
base_url = re.sub(r'\/images\/$', '/analyzed_images/', str(request.url))
infile = open(incoming_dir / file.filename)
file_hash = hashlib.sha256()
file_hash.update(incoming_data)
file_hash.update(image)
with open(infile, "w") as f:
f.write(incoming_data)
f.write(image)
print("save complete")
print("analyzing image")
result = detector.detect_objects(infile, file_hash.hexdigest() + ".png")