Commit fd351764 authored by kurumuz's avatar kurumuz

make base64 work

parent d41ec0fd
from dotmap import DotMap
import math
from io import BytesIO
import base64
v1pp_defaults = {
'steps': 50,
......@@ -94,7 +95,11 @@ def sanitize_stable_diffusion(request):
if request.image is not None:
#decode from base64
request.image = request.image.decode('base64')
try:
request.image = base64.b64decode(request.image.encode('utf-8'))
except Exception as e:
return False, "image is not valid base64"
#check if image is valid
try:
from PIL import Image
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment