1
0
forked from s434650/CatOrNot

Compare commits

..

12 Commits
docs ... master

Author SHA1 Message Date
Miccowhy
2b44aee238 move merged request 2019-01-03 22:18:57 +01:00
21e04c9f18 Merge branch 'master' of s432759/CatOrNot into master 2019-01-03 21:13:47 +00:00
Mikołaj Aleksandrzak
9a1659292c Branch cleanup 2019-01-02 14:41:53 +01:00
f1ad502f13 Merge branch 'master' of s434603/CatOrNot into master 2019-01-02 13:26:04 +00:00
04df0bed03 Завантажувати файли до '' 2019-01-02 13:20:32 +00:00
b7c8a2f4d1 use case specification 2018-12-28 22:24:23 +00:00
9c9a9ce770 scope v2 2018-12-28 22:23:30 +00:00
Miccowhy
2e8abef8a5 cleanup of a master branch 2018-12-28 14:41:52 +01:00
Miccowhy
83134656a9 update README 2018-12-28 14:34:31 +01:00
fdb66a042b Merge branch 'master' of s434599/CatOrNot into master 2018-12-28 13:14:27 +00:00
Miccowhy
8cfa2f85ae update to srs 2018-12-28 14:09:49 +01:00
db7e5971f7 Upload files to '' 2018-12-24 12:56:13 +00:00
19 changed files with 18 additions and 98 deletions

18
README.md Normal file
View File

@ -0,0 +1,18 @@
# Cat or Not - artifact repository
# First prototype
### Monday 15:30 group
## How to use this repository?
To send an artifact for evaluation, create a pull request with it. Accepted artifacts will be merged into repository.
In case of an artifact not passing a quality control, person responsible will be contacted with informations about necessary changes.
Documentation is located in the **docs** branch.
Application prototype is located in the **app** branch.
## Version Control Document
It is located in a [repository's wiki](https://git.wmi.amu.edu.pl/s434650/CatOrNot/wiki/Version+History+Document). It will be updated with each accepted artifact.
## Heroku application
https://lit-wildwood-10245.herokuapp.com/

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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.

View File

@ -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

View File

@ -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?')

View File

@ -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

View 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)

View File

@ -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>

View File

@ -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 %}