Didn't import `re`

This commit is contained in:
niten 2023-01-09 10:42:16 -08:00
parent 35cc4221a1
commit 8254b94a88
1 changed files with 8 additions and 7 deletions

View File

@ -1,16 +1,17 @@
#!/usr/bin/env python3
from detector import Detector
from fastapi import FastAPI, HTTPException, Request, UploadFile, File
from fastapi.responses import FileResponse
from detector import Detector
import tempfile
from pathlib import Path
import hashlib
import os
from os import listdir, remove
from os.path import getatime, splitext
from time import sleep
from pathlib import Path
from threading import Thread
from time import sleep
import hashlib
import os
import re
import tempfile
def get_envvar(name):
@ -112,7 +113,7 @@ def result_to_dict(res, base_url):
@app.post("/images")
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))
base_url = re.sub(r'\/images\/?$', '/analyzed_images/', str(request.url))
infile = open(incoming_dir / file.filename)
file_hash = hashlib.sha256()
file_hash.update(image)