mirror of
https://github.com/Sheldan/Sissi.git
synced 2026-01-26 19:21:43 +00:00
[SIS-xxx] adding html wrapper for debra images
restructuring and splitting image generation into multiple files adding doge sun image generation
This commit is contained in:
17
python/modules/rest-api/utils.py
Normal file
17
python/modules/rest-api/utils.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from io import BytesIO
|
||||
|
||||
from flask import send_file
|
||||
|
||||
|
||||
def serve_pil_image(pil_img):
|
||||
img_io = BytesIO()
|
||||
pil_img.save(img_io, 'PNG')
|
||||
img_io.seek(0)
|
||||
return send_file(img_io, mimetype='image/png')
|
||||
|
||||
|
||||
class ValidationException(Exception):
|
||||
def __init__(self, provided_value, message):
|
||||
self.provided_value = provided_value
|
||||
self.message = message
|
||||
super().__init__(f'{self.message}: provided value: {provided_value}')
|
||||
Reference in New Issue
Block a user