Skip to content

Commit

Permalink
Update dependencies to make the app run again
Browse files Browse the repository at this point in the history
  • Loading branch information
angristan committed Oct 21, 2023
1 parent 8d55a9d commit 42808c3
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 34 deletions.
10 changes: 6 additions & 4 deletions app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import logging
import os
from flask_uploads import UploadSet, IMAGES, configure_uploads
from logging.handlers import RotatingFileHandler

from flask import Flask
from flask_bootstrap import Bootstrap4
from flask_uploads import IMAGES, UploadSet, configure_uploads

from config import Config
from flask_bootstrap import Bootstrap
from logging.handlers import RotatingFileHandler

app = Flask(__name__)
app.config.from_object(Config)
Expand All @@ -24,7 +26,7 @@
file_handler.setLevel(logging.INFO)
app.logger.addHandler(file_handler)

bootstrap = Bootstrap(app)
bootstrap = Bootstrap4(app)

images = UploadSet('images', IMAGES)
configure_uploads(app, images)
Expand Down
4 changes: 1 addition & 3 deletions app/forms.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from flask_uploads import IMAGES, UploadSet, configure_uploads
from flask_wtf import FlaskForm
from flask_wtf.file import FileAllowed, FileField, FileRequired
from wtforms import IntegerField
from flask_wtf.file import FileField, FileAllowed, FileRequired
from wtforms.fields.simple import SubmitField

from app import images
from app import app


class UploadForm(FlaskForm):
Expand Down
11 changes: 4 additions & 7 deletions app/routes.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import os
import numbers

from flask import render_template, request, abort
from flask.helpers import url_for
from werkzeug import redirect, secure_filename
from flask import render_template, request
from flask.json import jsonify
from webcolors import hex_to_rgb
from werkzeug.utils import secure_filename

from app import app
from app import images
from app.forms import UploadForm
from app.utils.kmeans import Kmeans
from app.utils.knn import Knn
from webcolors import hex_to_rgb
from flask.json import jsonify

ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg'])

Expand Down
2 changes: 0 additions & 2 deletions app/utils/kmeans.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import cv2
import imutils

from sklearn.cluster import KMeans
from webcolors import rgb_to_hex

Expand All @@ -18,7 +17,6 @@ def clusterize(self):
# and improve the quality of the clustering
self.model = KMeans(n_clusters = self.clusters,
init = 'k-means++',
n_jobs = -1,
n_init = 10,
max_iter = 300,
algorithm='elkan')
Expand Down
5 changes: 3 additions & 2 deletions app/utils/knn.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from sklearn.neighbors import KNeighborsClassifier
from sklearn import preprocessing
import pandas as pd
from sklearn import preprocessing
from sklearn.neighbors import KNeighborsClassifier


class Knn:

Expand Down
1 change: 1 addition & 0 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os


class Config(object):
SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess'
UPLOADS_DEFAULT_DEST = os.environ.get('UPLOADS_DEFAULT_DEST') or '/tmp'
Expand Down
32 changes: 16 additions & 16 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Flask==1.1.2
opencv-python==4.2.0.34
opencv-python-headless==4.2.0.34
Werkzeug<1
Flask==3.0.0
opencv-python==4.8.1.78
opencv-python-headless==4.8.1.78
Werkzeug==3.0.0
sklearn==0.0
python-dotenv==0.13.0
Flask-WTF==0.14.3
WTForms==2.3.1
Flask-Uploads==0.2.1
numpy==1.18.4
Pillow==7.1.2
psycopg2==2.8.5
gunicorn==20.0.4
webcolors==1.11.1
pandas==1.0.3
Bootstrap-Flask==1.3.1
imutils==0.5.3
python-dotenv==1.0.0
Flask-WTF==1.2.1
WTForms==3.1.0
Flask-Reuploaded==1.4.0
numpy==1.26.1
Pillow==10.1.0
psycopg2==2.9.9
gunicorn==21.2.0
webcolors==1.13
pandas==2.1.1
Bootstrap-Flask==2.3.2
imutils==0.5.4

0 comments on commit 42808c3

Please sign in to comment.