Skip to content

Commit 0e0831f

Browse files
authored
FEAT: Add contributors section and Fix non-hand bug (#12)
* DOCS: Project description * REFACTOR: Modeling code refactor * REFACTOR: Modeling code refactor * FIX: Add non-hand process when given image probability less than 70%, return non-hand guide message * FEAT: Add contributors section Add image and link
1 parent 6d98232 commit 0e0831f

File tree

7 files changed

+51
-22
lines changed

7 files changed

+51
-22
lines changed

app.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from flask import Flask, render_template, request
22
from werkzeug.utils import secure_filename
3-
import modeling as ml
3+
import model as ml
44
import tensorflow as tf
55
import numpy as np
66
import rps_battle
@@ -23,7 +23,9 @@ def index():
2323
return render_template("index.html", error=404)
2424
file_path = 'static/images/' + secure_filename(f.filename)
2525
f.save(file_path)
26-
probability = ml.rps_predict(file_path, model)
26+
probability = ml.rps_predict(file_path, model)[0]
27+
if max(probability) < 0.7:
28+
return render_template("index.html", unknown=True)
2729
user_str = class_names[np.argmax(probability)]
2830
result, com_path, com = rps_battle.checkWin(np.argmax(probability))
2931
com_str = class_names[com]
File renamed without changes.

static/assets/sangho.png

332 KB
Loading

static/assets/soohyun.png

179 KB
Loading

static/css/styles.css

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ button {
879879
padding-top:.3125rem;
880880
padding-bottom:.3125rem;
881881
margin-right:1rem;
882-
font-size:1.25rem;
882+
font-size:1.55rem;
883883
text-decoration:none;
884884
white-space:nowrap
885885
}
@@ -916,6 +916,13 @@ button {
916916
.navbar-light .navbar-text a,.navbar-light .navbar-text a:focus,.navbar-light .navbar-text a:hover {
917917
color:rgba(0,0,0,.9)
918918
}
919+
.navbar-title {
920+
margin-right:1rem;
921+
font-size:1.55rem;
922+
text-decoration:none;
923+
text-align:bottom;
924+
white-space:nowrap
925+
}
919926
.page-link {
920927
position:relative;
921928
display:block;
@@ -1226,6 +1233,12 @@ button {
12261233
padding-top:3rem!important;
12271234
padding-bottom:3rem!important
12281235
}
1236+
.fs-img {
1237+
width: 50px;
1238+
height: 50px;
1239+
object-fit: scale-down;
1240+
}
1241+
12291242
.fs-1 {
12301243
font-size:calc(1.375rem+1.5vw)!important
12311244
}
-42.4 KB
Binary file not shown.

templates/index.html

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,17 @@
1919
<!-- Navigation-->
2020
<nav class="navbar navbar-light bg-light static-top">
2121
<div class="container">
22-
<a class="navbar-brand" href="#!">Forward-Lab</a>
22+
<a class="navbar-brand" href="">Forward-Lab</a>
23+
<div class="col-lg-6 h-100 text-center text-lg-end my-auto">
24+
<ul class="list-inline mb-0">
25+
<li class="list-inline-item">
26+
<a href="https://github.com/sangho5o5"><img src="static\assets\sangho.png" class="fs-img"></a>
27+
</li>
28+
<li class="list-inline-item">
29+
<a href="https://github.com/soohyunme"><img src="static\assets\soohyun.png" class="fs-img"></a>
30+
</li>
31+
</ul>
32+
</div>
2333
</div>
2434
</nav>
2535
<!-- Masthead-->
@@ -40,9 +50,6 @@ <h1 class="mb-5">Rock Paper Scissors!</h1>
4050
<div class="col-auto"><button class="btn btn-primary btn-lg" id="submitButton" type="submit">Submit</button></div>
4151
</div>
4252
</form>
43-
{% if error %}
44-
<h3 class="text-white">Image must be .jpg or .png</h3>
45-
{%endif%}
4653
</div>
4754
</div>
4855
</div>
@@ -81,8 +88,15 @@ <h3>CPU</h3>
8188
</div>
8289
</div>
8390
</section>
91+
{%elif unknown%}
92+
<section class="features-icons bg-light text-center">
93+
<h1 class="mb-5">Maybe that's not hand picture...</h1>
94+
</section>
95+
{%elif error==404%}
96+
<section class="features-icons bg-light text-center">
97+
<h1 class="mb-5">Image must be .jpg or .png</h1>
98+
</section>
8499
{%else%}
85-
<!-- Icons Grid-->
86100
<section class="features-icons bg-light text-center">
87101
<h1 class="mb-5">Add a picture of your hand and submit!</h1>
88102
</section>
@@ -96,20 +110,20 @@ <h1 class="mb-5">Add a picture of your hand and submit!</h1>
96110
</ul>
97111
<p class="text-muted small mb-4 mb-lg-0">&copy; Forward-Lab 2021. All Rights Reserved.</p>
98112
</div>
99-
<div class="col-lg-6 h-100 text-center text-lg-end my-auto">
100-
<ul class="list-inline mb-0">
101-
</li>
102-
<li class="list-inline-item me-4">
103-
<a href="#!"><i class="bi-facebook fs-3"></i></a>
104-
</li>
105-
<li class="list-inline-item me-4">
106-
<a href="#!"><i class="bi-twitter fs-3"></i></a>
107-
</li>
108-
<li class="list-inline-item">
109-
<a href="#!"><i class="bi-instagram fs-3"></i></a>
110-
</li>
111-
</ul>
112-
</div>
113+
<!-- <div class="col-lg-6 h-100 text-center text-lg-end my-auto">-->
114+
<!-- <ul class="list-inline mb-0">-->
115+
<!-- </li>-->
116+
<!-- <li class="list-inline-item me-4">-->
117+
<!-- <a href="#!"><i class="bi-facebook fs-3"></i></a>-->
118+
<!-- </li>-->
119+
<!-- <li class="list-inline-item me-4">-->
120+
<!-- <a href="#!"><i class="bi-twitter fs-3"></i></a>-->
121+
<!-- </li>-->
122+
<!-- <li class="list-inline-item">-->
123+
<!-- <a href="#!"><i class="bi-instagram fs-3"></i></a>-->
124+
<!-- </li>-->
125+
<!-- </ul>-->
126+
<!-- </div>-->
113127
</div>
114128
</div>
115129
</footer>

0 commit comments

Comments
 (0)