Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(ai): first implementation of the PaletteNet algorithm managed from image-go-nord package #162

Merged
merged 22 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1b6ec6f
Merge branch 'master' of github.com:Schrodinger-Hat/ImageGoNord
TheJoin95 Jul 27, 2023
0e115df
fix(minor): remove useless console.log
TheJoin95 Jul 27, 2023
3fd10a9
Merge branch 'master' of github.com:Schrodinger-Hat/ImageGoNord
TheJoin95 Apr 2, 2024
cd6a9de
feat: add 6x color palette in json format
TheJoin95 Apr 4, 2024
944a51c
feat(ImagIA): add new page
TheJoin95 Apr 9, 2024
e6016ed
styles: update palettes to global
TheJoin95 Apr 9, 2024
c4623b1
wip: update goWild and ImagIa to reuse component
TheJoin95 Apr 9, 2024
38fa2f7
wip: update 6x palettes format
TheJoin95 Apr 9, 2024
6d1031a
feat(page): add imagIA features frontend
TheJoin95 May 23, 2024
d895fef
feat(api): add support to use_model parameter
TheJoin95 May 23, 2024
a93e02e
chore(api): update requirements
TheJoin95 May 23, 2024
2513ca3
Merge branch 'master' of github.com:Schrodinger-Hat/ImageGoNord
TheJoin95 May 27, 2024
f68102f
feat: add 6x color palette in json format
TheJoin95 Apr 4, 2024
058f126
feat(ImagIA): add new page
TheJoin95 Apr 9, 2024
50b9125
styles: update palettes to global
TheJoin95 Apr 9, 2024
9a37a95
wip: update goWild and ImagIa to reuse component
TheJoin95 Apr 9, 2024
5375023
wip: update 6x palettes format
TheJoin95 Apr 9, 2024
e562d87
feat(page): add imagIA features frontend
TheJoin95 May 23, 2024
85de0be
feat(api): add support to use_model parameter
TheJoin95 May 23, 2024
2a1c580
chore(api): update requirements
TheJoin95 May 23, 2024
723fc15
@wabri review
TheJoin95 May 27, 2024
6794872
Merge branch 'feat/ai-conversion-step0' of github.com:Schrodinger-Hat…
TheJoin95 May 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
image-go-nord==0.1.4
image-go-nord==1.1.0
9 changes: 5 additions & 4 deletions src/ign-api/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ def convert_queue():

if (request.form.get('palette_name') != None):
palette_name = request.form.get('palette_name')


use_model = request.form.get('is_ai') is not None
conn.incr('conversion_count', 1)

if is_image(file.filename):
image = go_nord.open_image(request.files.get('file').stream)
job = q.enqueue(f=convert_image, ttl=900, failure_ttl=900, job_timeout='180s', args=(go_nord, image, output_path, request.form.get('b64_output'), response))
job = q.enqueue(f=convert_image, ttl=900, failure_ttl=900, job_timeout='180s', args=(go_nord, image, output_path, request.form.get('b64_output'), response, use_model))
TheJoin95 marked this conversation as resolved.
Show resolved Hide resolved
elif is_video(file.filename):
now = datetime.now() # current date and time
filename = now.strftime("%m%d%Y-%H%M%S")
Expand All @@ -64,8 +65,8 @@ def is_image(filename):
return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in ['png', 'jpg', 'jpeg']

def convert_image(go_nord, image, save_path, b64_output, response):
image = go_nord.convert_image(image, save_path=save_path)
def convert_image(go_nord, image, save_path, b64_output, response, use_model=False):
image = go_nord.convert_image(image, save_path=save_path, use_model=use_model)
if (b64_output != None):
b64_image = go_nord.image_to_base64(image, 'png')
base64_img_string = b64_image.decode('UTF-8')
Expand Down
12 changes: 9 additions & 3 deletions src/ign-api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
Pillow==7.2.0
Pillow==10.3.0
flask==1.1.2
flask_cors==3.0.8
image-go-nord==0.1.7
image-go-nord==1.1.0
gunicorn==20.0.4
rq==1.8.0
pytest==6.0.2
itsdangerous==2.0.1
Werkzeug==2.0.3
Werkzeug==2.0.3
ffmpeg-python==0.2.0
numpy==1.24.4
torch==2.2.2
torch-vision==0.1.6.dev0
torchvision==0.17.2
scikit-image=0.19.2
Loading