19 lines
526 B
Python
19 lines
526 B
Python
|
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)
|