Spaces:
Build error
Build error
change language and add tip
Browse files- deploy/__pycache__/functions.cpython-310.pyc +0 -0
- deploy/app.py +2 -3
- deploy/static/styles.css +11 -11
- deploy/templates/webpage.html +5 -4
deploy/__pycache__/functions.cpython-310.pyc
ADDED
|
Binary file (845 Bytes). View file
|
|
|
deploy/app.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
#Import Library
|
| 2 |
from flask import Flask, request, jsonify, render_template, send_from_directory
|
| 3 |
import os
|
| 4 |
-
from tensorflow import keras
|
| 5 |
from keras.models import load_model
|
| 6 |
|
| 7 |
#Import functions and model
|
|
@@ -9,7 +8,7 @@ from functions import predict
|
|
| 9 |
|
| 10 |
model = load_model('model_mnist.h5')
|
| 11 |
|
| 12 |
-
app = Flask('
|
| 13 |
|
| 14 |
@app.route('/')
|
| 15 |
def index():
|
|
@@ -36,7 +35,7 @@ def process_drawing():
|
|
| 36 |
|
| 37 |
return jsonify(response)
|
| 38 |
|
| 39 |
-
return jsonify({"response": "Erro:
|
| 40 |
|
| 41 |
if __name__ == '__main__':
|
| 42 |
app.run()
|
|
|
|
| 1 |
#Import Library
|
| 2 |
from flask import Flask, request, jsonify, render_template, send_from_directory
|
| 3 |
import os
|
|
|
|
| 4 |
from keras.models import load_model
|
| 5 |
|
| 6 |
#Import functions and model
|
|
|
|
| 8 |
|
| 9 |
model = load_model('model_mnist.h5')
|
| 10 |
|
| 11 |
+
app = Flask('my app', template_folder='templates')
|
| 12 |
|
| 13 |
@app.route('/')
|
| 14 |
def index():
|
|
|
|
| 35 |
|
| 36 |
return jsonify(response)
|
| 37 |
|
| 38 |
+
return jsonify({"response": "Erro: Image data not received."})
|
| 39 |
|
| 40 |
if __name__ == '__main__':
|
| 41 |
app.run()
|
deploy/static/styles.css
CHANGED
|
@@ -14,7 +14,7 @@ body {
|
|
| 14 |
}
|
| 15 |
|
| 16 |
header {
|
| 17 |
-
|
| 18 |
color: #fff;
|
| 19 |
text-align: center;
|
| 20 |
padding: 0px 0;
|
|
@@ -31,32 +31,32 @@ header {
|
|
| 31 |
|
| 32 |
#sendDrawing, #clearCanvas {
|
| 33 |
display: inline-block;
|
| 34 |
-
margin: 10px;
|
| 35 |
-
padding: 10px 20px;
|
| 36 |
-
background-color: #1265e0;
|
| 37 |
-
color: #fff;
|
| 38 |
border: none;
|
| 39 |
border-radius: 5px;
|
| 40 |
cursor: pointer;
|
| 41 |
-
transition: background-color 0.3s;
|
| 42 |
}
|
| 43 |
|
| 44 |
#sendDrawing:hover, #clearCanvas:hover {
|
| 45 |
-
background-color: #023d7c;
|
| 46 |
}
|
| 47 |
|
| 48 |
#textbox-container {
|
| 49 |
text-align: center;
|
| 50 |
-
margin-top: 20px;
|
| 51 |
}
|
| 52 |
|
| 53 |
#bigChar {
|
| 54 |
-
font-size: 40px;
|
| 55 |
-
margin-bottom: 10px;
|
| 56 |
}
|
| 57 |
|
| 58 |
#number {
|
| 59 |
-
font-size: 24px;
|
| 60 |
}
|
| 61 |
|
| 62 |
.grid-container {
|
|
|
|
| 14 |
}
|
| 15 |
|
| 16 |
header {
|
| 17 |
+
|
| 18 |
color: #fff;
|
| 19 |
text-align: center;
|
| 20 |
padding: 0px 0;
|
|
|
|
| 31 |
|
| 32 |
#sendDrawing, #clearCanvas {
|
| 33 |
display: inline-block;
|
| 34 |
+
margin: 10px;
|
| 35 |
+
padding: 10px 20px;
|
| 36 |
+
background-color: #1265e0;
|
| 37 |
+
color: #fff;
|
| 38 |
border: none;
|
| 39 |
border-radius: 5px;
|
| 40 |
cursor: pointer;
|
| 41 |
+
transition: background-color 0.3s;
|
| 42 |
}
|
| 43 |
|
| 44 |
#sendDrawing:hover, #clearCanvas:hover {
|
| 45 |
+
background-color: #023d7c;
|
| 46 |
}
|
| 47 |
|
| 48 |
#textbox-container {
|
| 49 |
text-align: center;
|
| 50 |
+
margin-top: 20px;
|
| 51 |
}
|
| 52 |
|
| 53 |
#bigChar {
|
| 54 |
+
font-size: 40px;
|
| 55 |
+
margin-bottom: 10px;
|
| 56 |
}
|
| 57 |
|
| 58 |
#number {
|
| 59 |
+
font-size: 24px;
|
| 60 |
}
|
| 61 |
|
| 62 |
.grid-container {
|
deploy/templates/webpage.html
CHANGED
|
@@ -19,8 +19,8 @@
|
|
| 19 |
|
| 20 |
<div id="button-container">
|
| 21 |
|
| 22 |
-
<button id="sendDrawing">
|
| 23 |
-
<button id="clearCanvas">
|
| 24 |
<script src="{{ url_for('static', filename='script.js') }}"></script>
|
| 25 |
|
| 26 |
</div>
|
|
@@ -29,8 +29,9 @@
|
|
| 29 |
|
| 30 |
<div id="textbox-container">
|
| 31 |
|
| 32 |
-
<div id="bigChar">
|
| 33 |
-
<div id="number">
|
|
|
|
| 34 |
|
| 35 |
</div>
|
| 36 |
|
|
|
|
| 19 |
|
| 20 |
<div id="button-container">
|
| 21 |
|
| 22 |
+
<button id="sendDrawing">Send drawing</button>
|
| 23 |
+
<button id="clearCanvas">Clear Drawing</button>
|
| 24 |
<script src="{{ url_for('static', filename='script.js') }}"></script>
|
| 25 |
|
| 26 |
</div>
|
|
|
|
| 29 |
|
| 30 |
<div id="textbox-container">
|
| 31 |
|
| 32 |
+
<div id="bigChar">Your digit is: <span id="digitoValor"></span></div>
|
| 33 |
+
<div id="number">Prediction probability: <span id="probabilidadeValor"></span>%</div>
|
| 34 |
+
<div>Tip: The larger your drawing, the better the model can recognize it.</div>
|
| 35 |
|
| 36 |
</div>
|
| 37 |
|