mirror of
https://github.com/Sheldan/Sissi.git
synced 2026-01-26 19:21:43 +00:00
[SIS-xxx] updating abstracto version
restructuring api to private and public rest api adding custom image generation module
This commit is contained in:
3
python/modules/debra-rest-api/docker/Dockerfile
Normal file
3
python/modules/debra-rest-api/docker/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM alpine:3.19.0
|
||||
ADD resources/ /python/resources
|
||||
ADD python /python
|
||||
3
python/modules/image-gen-api/docker/Dockerfile
Normal file
3
python/modules/image-gen-api/docker/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM alpine:3.19.0
|
||||
ADD resources/ /python/resources
|
||||
ADD python /python
|
||||
24
python/modules/image-gen-api/python/endpoints/doge.py
Normal file
24
python/modules/image-gen-api/python/endpoints/doge.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from __main__ import app
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
from flask import request
|
||||
import logging
|
||||
|
||||
from utils import flask_utils
|
||||
|
||||
@app.route('/memes/doge/orangeSun/')
|
||||
def doge_orange_sun():
|
||||
text = request.args.get('text')
|
||||
if text is None:
|
||||
return 'no text', 400
|
||||
logging.info(f'Rendering doge orange sun.')
|
||||
with Image.open('resources/img/semf_template.jpg') as im:
|
||||
d1 = ImageDraw.Draw(im)
|
||||
text_box_size = (300, 240)
|
||||
W, H = text_box_size
|
||||
font = ImageFont.truetype(f'Impact.ttf', 60)
|
||||
_, _, w, h = d1.textbbox((0, 0), text, font=font)
|
||||
d1.text(((W-w)/2 + 320, (H-h)/2 + 120), text, font=font, fill=(255, 255, 255))
|
||||
return flask_utils.serve_pil_image(im)
|
||||
|
||||
|
||||
BIN
python/modules/image-gen-api/resources/img/semf_template.jpg
Normal file
BIN
python/modules/image-gen-api/resources/img/semf_template.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user