diff --git a/Procfile b/Procfile deleted file mode 100644 index 9df3bff..0000000 --- a/Procfile +++ /dev/null @@ -1,3 +0,0 @@ -web: gunicorn cat_or_not -heroku ps:scale web=1 -export GOOGLE_APPLICATION_CREDENTIALS="authentication.json" diff --git a/__pycache__/cat_or_not.cpython-36.pyc b/__pycache__/cat_or_not.cpython-36.pyc deleted file mode 100644 index 63f3e4d..0000000 Binary files a/__pycache__/cat_or_not.cpython-36.pyc and /dev/null differ diff --git a/__pycache__/cat_recognition.cpython-36.pyc b/__pycache__/cat_recognition.cpython-36.pyc deleted file mode 100644 index 5f0382d..0000000 Binary files a/__pycache__/cat_recognition.cpython-36.pyc and /dev/null differ diff --git a/__pycache__/config.cpython-36.pyc b/__pycache__/config.cpython-36.pyc deleted file mode 100644 index 442ed48..0000000 Binary files a/__pycache__/config.cpython-36.pyc and /dev/null differ diff --git a/__pycache__/forms.cpython-36.pyc b/__pycache__/forms.cpython-36.pyc deleted file mode 100644 index 18070b2..0000000 Binary files a/__pycache__/forms.cpython-36.pyc and /dev/null differ diff --git a/__pycache__/hello.cpython-36.pyc b/__pycache__/hello.cpython-36.pyc deleted file mode 100644 index 47f8c9f..0000000 Binary files a/__pycache__/hello.cpython-36.pyc and /dev/null differ diff --git a/app/__init__.py b/app/__init__.py deleted file mode 100644 index f5b34f4..0000000 --- a/app/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -from flask import Flask -from config import Config - -app = Flask(__name__) -app.config.from_object(Config) - -from app import routes diff --git a/app/__pycache__/__init__.cpython-36.pyc b/app/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 10c727a..0000000 Binary files a/app/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/app/__pycache__/cat_recognition.cpython-36.pyc b/app/__pycache__/cat_recognition.cpython-36.pyc deleted file mode 100644 index 9289b2a..0000000 Binary files a/app/__pycache__/cat_recognition.cpython-36.pyc and /dev/null differ diff --git a/app/__pycache__/forms.cpython-36.pyc b/app/__pycache__/forms.cpython-36.pyc deleted file mode 100644 index 8e14a92..0000000 Binary files a/app/__pycache__/forms.cpython-36.pyc and /dev/null differ diff --git a/app/__pycache__/picture_downloader.cpython-36.pyc b/app/__pycache__/picture_downloader.cpython-36.pyc deleted file mode 100644 index 1fd1e52..0000000 Binary files a/app/__pycache__/picture_downloader.cpython-36.pyc and /dev/null differ diff --git a/app/__pycache__/routes.cpython-36.pyc b/app/__pycache__/routes.cpython-36.pyc deleted file mode 100644 index 32d5883..0000000 Binary files a/app/__pycache__/routes.cpython-36.pyc and /dev/null differ diff --git a/app/cat_recognition.py b/app/cat_recognition.py deleted file mode 100644 index b65d418..0000000 --- a/app/cat_recognition.py +++ /dev/null @@ -1,20 +0,0 @@ -# Imports the Google Cloud client library -from google.cloud import vision -from google.cloud.vision import types - -def is_cat(content): - labels = fetch_data(content) - if labels[0].description == "cat": - return True - else: - return False - -def fetch_data(content): - # Instantiates a client - client = vision.ImageAnnotatorClient() - # Tell Google Vision that our content is of type Image - image = types.Image(content=content) - # Performs label detection on the image file - response = client.label_detection(image=image) - # Return array of labels - return response.label_annotations diff --git a/app/forms.py b/app/forms.py deleted file mode 100644 index ab65d4c..0000000 --- a/app/forms.py +++ /dev/null @@ -1,7 +0,0 @@ -from flask_wtf import FlaskForm -from wtforms import StringField, PasswordField, BooleanField, SubmitField -from wtforms.validators import DataRequired - -class UploadForm(FlaskForm): - url = StringField('Link', validators=[DataRequired()]) - submit = SubmitField('Cat or not?') diff --git a/app/picture_downloader.py b/app/picture_downloader.py deleted file mode 100644 index 3304f35..0000000 --- a/app/picture_downloader.py +++ /dev/null @@ -1,10 +0,0 @@ -import requests - -def get_image_from_url(url): - f = open('pic.jpg','wb') - f.write(requests.get(url).content) - f.close() - f = open('pic.jpg','rb') - file = f.read() - f.close() - return file diff --git a/app/routes.py b/app/routes.py deleted file mode 100644 index feedcbd..0000000 --- a/app/routes.py +++ /dev/null @@ -1,18 +0,0 @@ -from flask import Flask -from flask import render_template -from app.forms import UploadForm -from app import app -from app import cat_recognition as cat -from app import picture_downloader as downloader - -@app.route('/', methods=['GET', 'POST']) -def index(): - form = UploadForm() - if form.validate_on_submit(): - content = downloader.get_image_from_url(form.url.data) - if cat.is_cat(content): - return "Cat!" - else: - return "Not!" - - return render_template('index.html', form=form) diff --git a/app/templates/base.html b/app/templates/base.html deleted file mode 100644 index 519c49c..0000000 --- a/app/templates/base.html +++ /dev/null @@ -1,23 +0,0 @@ - - -
- {% if title %} -