forked from s434650/CatOrNot
remove non-documentation files
This commit is contained in:
parent
83134656a9
commit
df02ee328b
3
Procfile
3
Procfile
@ -1,3 +0,0 @@
|
|||||||
web: gunicorn cat_or_not
|
|
||||||
heroku ps:scale web=1
|
|
||||||
export GOOGLE_APPLICATION_CREDENTIALS="authentication.json"
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,7 +0,0 @@
|
|||||||
from flask import Flask
|
|
||||||
from config import Config
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
|
||||||
app.config.from_object(Config)
|
|
||||||
|
|
||||||
from app import routes
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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
|
|
@ -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?')
|
|
@ -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
|
|
@ -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)
|
|
@ -1,23 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
{% if title %}
|
|
||||||
<title>{{ title }} | Cat or Not</title>
|
|
||||||
{% else %}
|
|
||||||
<title>Cat or Not</title>
|
|
||||||
{% endif %}
|
|
||||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
{% with messages = get_flashed_messages() %}
|
|
||||||
{% if messages %}
|
|
||||||
<ul>
|
|
||||||
{% for message in messages %}
|
|
||||||
<li>{{ message }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
{% endwith %}
|
|
||||||
{% block content %}{% endblock %}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,13 +0,0 @@
|
|||||||
{% extends "base.html" %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<h1>Check if the picture is cat or not!</h1>
|
|
||||||
<form action="" method="post" novalidate>
|
|
||||||
{{ form.hidden_tag() }}
|
|
||||||
<p>
|
|
||||||
{{ form.url.label }}<br>
|
|
||||||
{{ form.url }}
|
|
||||||
</p>
|
|
||||||
<p>{{ form.submit() }}</p>
|
|
||||||
</form>
|
|
||||||
{% endblock %}
|
|
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"type": "service_account",
|
|
||||||
"project_id": "quiet-odyssey-225116",
|
|
||||||
"private_key_id": "f2553a958e511debcf46d10957e3c7fbdb906aa1",
|
|
||||||
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDfmChqO8VSfmEi\nSNeGhgq3jCe5iCk67yoaatQ9kYd10pmVST6OjJ3nmxd1iYAAYCB59wV4V19C67oj\n5x0bxhhKITilS94bNhZJFB4FjwMIGrDXe9SGcZwSwrB+ggFhvZGNQjYWDe7rrJ/V\nXemA8kO/wfVYUgHsjWXm3VKEeP4G0j8mndA+PP2T/aJNIWok5IA/emqr305YNMvd\n+C8TB6htf4Pqe1ZDHNyrGzYKUy1KbMAdtBXgmpVCKeo4XdlV1s0y7tVnCN+4MUM5\nVAP1fD9985fh84Zw+nMt6//pxGORwnvTNDjPjPwqEwQbV02YcfYMKPjXWSDFxv+v\nOqDUwAsjAgMBAAECggEAaQNRl/NSjZgFjtCfSPMTfXk5/w1QL/m70IR0AiajdFbh\nAxhPZSvtzaUts2pMz+BV4HKAAzEl8Iw99DbLmQvExKwtqpSjUCxq8w+bugic5+WB\nQPNLsYkSQE1oD0KH25vpDGsYc+s/VzjQKKnezUz7PMifrkd119/hCDjSVJ1u0Ux0\nit7ZsoLFzWWorC1CVUPHMqUtlgF8L85w4Yfma7X64yoPNvomI4MFV8E9UfUoZBY0\n02x8mBNX9fjIHzNXkyF6OD8O1IMkrADaJbdmcfgMwBWtarIEsNIiUQsFnFeaN69b\nf26NTQQux9jgMJnMu9V1TNdG6K6TshIw8a/uB4lmYQKBgQD8AUg0Qu9tS8Y4AQfq\nd/0frLIitmnzVs0Lt3TFIw1OjUrfki5gStAEVGhIN2SXLF6lWjqrtk43xQFjzuKr\nL9kuN76MbYDnITuew+9VJPnmA2EiTspcVPNph44FqPSNOar9GCCY7QB6ue+fm5bq\nFyPaHfoKuRmwbvHqVgI2L2HJbQKBgQDjI5OEWYxfJLC6StpEmmOY8W19ZQPTXBKt\nfLSEsDuAjrC2kT6ladXezYuYy/VSAbjdCYbJ1yDABNILDZky0ZSD2midtnqe3z0v\nTKBudkxEDYgRKvgQxMY89N6JpSOedY3v63cOvRwPbVi4sF+REbRu4e+OVsIlpXaK\n/IcINZdczwKBgQCNl87RBnbuqy+xkeq3tDl2DZt9Y47+WdwV5Dto9LvqUfsqyUDj\ne8WLWT3Krc0IH7cCI0Np7aHfNgME6F51nwnhLRMUZgaSVxrfpumXppH+yhFOrISJ\nAnZN6gtDZN4bZ7aKRH80TZ4CVuyrekl+OAg96q/uTHiBqKSmbTMK7O59tQKBgCMD\n3f7eKySTrGbbmTBQOKBgP4fAJcnUfNCf09hMrq+Pz7AlTeoEGcNCHo4MiyH8P/pb\nOJsu/c58L8EidIaABowZBF2jvt10/qKnBmhg9jrbdylmXV2AaCsHeLLxcT9BUgM1\nYmI0Rvod2jqGfgUIHK+nRt3DhCR3kIG2kj5yvIXDAoGAVNd8sw08+U4JMg0TPK71\nhWNeXyNc9aLpehqdIVQPs6KdhlVcoFHKLCDASzMUxNtU27b3Nqgh5dBS4YbNKXoa\n5UZUvxa2Khw1/rT9wTcaIap0kfh1SOZseSfpNUy5mrSKnnVkIn1NKmI0a+mN0gcT\nD706pAo2V7oFEQFocuua1yY=\n-----END PRIVATE KEY-----\n",
|
|
||||||
"client_email": "c00lerxo@quiet-odyssey-225116.iam.gserviceaccount.com",
|
|
||||||
"client_id": "106421721962581253770",
|
|
||||||
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
|
||||||
"token_uri": "https://oauth2.googleapis.com/token",
|
|
||||||
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
|
||||||
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/c00lerxo%40quiet-odyssey-225116.iam.gserviceaccount.com"
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
from app import app as application
|
|
@ -1,4 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
class Config(object):
|
|
||||||
SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess'
|
|
@ -1,26 +0,0 @@
|
|||||||
cachetools==3.0.0
|
|
||||||
certifi==2018.11.29
|
|
||||||
chardet==3.0.4
|
|
||||||
Click==7.0
|
|
||||||
Flask==1.0.2
|
|
||||||
Flask-WTF==0.14.2
|
|
||||||
google-api-core==1.6.0
|
|
||||||
google-auth==1.6.1
|
|
||||||
google-cloud-vision==0.35.1
|
|
||||||
googleapis-common-protos==1.5.5
|
|
||||||
grpcio==1.17.0
|
|
||||||
gunicorn==19.9.0
|
|
||||||
idna==2.8
|
|
||||||
itsdangerous==1.1.0
|
|
||||||
Jinja2==2.10
|
|
||||||
MarkupSafe==1.1.0
|
|
||||||
protobuf==3.6.1
|
|
||||||
pyasn1==0.4.4
|
|
||||||
pyasn1-modules==0.2.2
|
|
||||||
pytz==2018.7
|
|
||||||
requests==2.21.0
|
|
||||||
rsa==4.0
|
|
||||||
six==1.12.0
|
|
||||||
urllib3==1.24.1
|
|
||||||
Werkzeug==0.14.1
|
|
||||||
WTForms==2.2.1
|
|
Loading…
Reference in New Issue
Block a user