forked from Ivasoft/geovisio-sgblur
Make blurring work (PR #33)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from fastapi import FastAPI, UploadFile, Response
|
||||
import gc
|
||||
from . import blur
|
||||
from . import blur_monolith as blur
|
||||
import json
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
@@ -36,7 +36,10 @@ def blurPicture(picture, keep):
|
||||
if 'SGBLUR_GPUS' in os.environ:
|
||||
gpu = pid % int(os.environ['SGBLUR_GPUS'])
|
||||
else:
|
||||
gpu = pid % torch.cuda.device_count()
|
||||
if torch.cuda.device_count() > 0:
|
||||
gpu = pid % torch.cuda.device_count()
|
||||
else:
|
||||
gpu = None
|
||||
|
||||
# copy received JPEG picture to temporary file
|
||||
tmp = '/dev/shm/blur%s.jpg' % pid
|
||||
Reference in New Issue
Block a user