Showing
3 changed files
with
109 additions
and
30 deletions
| 1 | body { | 1 | body { |
| 2 | - padding: 50px; | 2 | + padding-top: 5px; |
| 3 | + padding-bottom: 20px; | ||
| 3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; | 4 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; |
| 4 | } | 5 | } |
| 5 | 6 | ||
| 6 | a { | 7 | a { |
| 7 | color: #00B7FF; | 8 | color: #00B7FF; |
| 8 | } | 9 | } |
| 10 | + | ||
| 11 | +/* 헤더 */ | ||
| 12 | +header{ | ||
| 13 | + height:70px; | ||
| 14 | + background-image: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%); | ||
| 15 | + -webkit-box-shadow: inset 0 -2px 5px rgba(0,0,0,.1); | ||
| 16 | + box-shadow: inset 0 -2px 5px rgba(0,0,0,.1); | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +.header_name{ | ||
| 20 | + margin: 15px; | ||
| 21 | + margin-left : 30px; | ||
| 22 | + float: left; | ||
| 23 | + font-size: 30px ; | ||
| 24 | + color: white; | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +/* footer */ | ||
| 28 | +footer{ | ||
| 29 | + padding: 40px 0; | ||
| 30 | + color: #999; | ||
| 31 | + text-align: center; | ||
| 32 | + background-color: #f9f9f9; | ||
| 33 | + border-top: 1px solid #e5e5e5; | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | +/* 메인 div를 나누기 위한 것. */ | ||
| 37 | +.box1{ | ||
| 38 | + float: left; | ||
| 39 | + width: 550px; | ||
| 40 | + padding:10px; | ||
| 41 | + margin:10px; | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +.box2{ | ||
| 45 | + display: inline-block; | ||
| 46 | + width: 35%; | ||
| 47 | + padding:10px; | ||
| 48 | + margin:10px; | ||
| 49 | + margin-left: 30px; | ||
| 50 | + | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +/* box2안의 이미지와 입력폼에 관한 css */ | ||
| 54 | +.alert_image{ | ||
| 55 | + width:100%; | ||
| 56 | +} | ||
| 57 | + | ||
| 58 | +.col-lg-6{ | ||
| 59 | + margin-top: 10px; | ||
| 60 | + width:100% | ||
| 61 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -14,7 +14,7 @@ router.get('/data', function(req, res, next){ | ... | @@ -14,7 +14,7 @@ router.get('/data', function(req, res, next){ |
| 14 | 14 | ||
| 15 | data = { | 15 | data = { |
| 16 | image : "/images/"+id+".jpg", | 16 | image : "/images/"+id+".jpg", |
| 17 | - audio : "/audio/"+id+".mp3" | 17 | + audio : "/audio"+id+".mp3" |
| 18 | } | 18 | } |
| 19 | //데이터 확인 | 19 | //데이터 확인 |
| 20 | console.log(data); | 20 | console.log(data); | ... | ... |
| ... | @@ -2,43 +2,69 @@ | ... | @@ -2,43 +2,69 @@ |
| 2 | <html> | 2 | <html> |
| 3 | <head> | 3 | <head> |
| 4 | <title><%= title %></title> | 4 | <title><%= title %></title> |
| 5 | + | ||
| 6 | + <!-- Bootstrap --> | ||
| 7 | + <!-- 합쳐지고 최소화된 최신 CSS --> | ||
| 8 | + <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> | ||
| 5 | <link rel='stylesheet' href='/stylesheets/style.css' /> | 9 | <link rel='stylesheet' href='/stylesheets/style.css' /> |
| 10 | + | ||
| 6 | </head> | 11 | </head> |
| 7 | <body> | 12 | <body> |
| 8 | - <h1><%= title %></h1> | 13 | + <!-- header --> |
| 9 | - <p>Welcome to <%= title %></p> | 14 | + <header> |
| 10 | - <!--https://teachablemachine.withgoogle.com/ 를 통해 학습시키고 얻은 스켈레톤 코드 --> | 15 | + <p class="header_name">MWD</p> |
| 11 | - | 16 | + </header> |
| 12 | - <div>Teachable Machine Image Model</div> | 17 | + |
| 13 | - <button type="button" onclick="init()">Start</button> | 18 | + <!-- main contents --> |
| 19 | + <div class="container" style="margin-top: 30px"> | ||
| 20 | + <div class="box1"> | ||
| 14 | <div id="webcam-container"></div> | 21 | <div id="webcam-container"></div> |
| 15 | - <div id="label-container"></div> | 22 | + <div id="label-container" ></div> |
| 16 | - <div id="check_image"> | ||
| 17 | - <img src="/images/1.jpg"> | ||
| 18 | </div> | 23 | </div> |
| 19 | - <div id = "check_audio"> | 24 | + <div class="box2"> |
| 20 | - <!--초기값으로 '시작'이라는 음성을 사용 --> | 25 | + <div id="check_image"> |
| 21 | - <!--auto play 기능을 위해 iframe 사용 --> | 26 | + <img class="alert_image" src="/images/1.jpg"> |
| 22 | - <iframe src="/audios/4.mp3" allow="autoplay" id="audio" style="display:none"></iframe> | ||
| 23 | </div> | 27 | </div> |
| 28 | + | ||
| 29 | + <!-- 인풋 폼 나중에 합치기 --> | ||
| 30 | + <div class="col-lg-6"> | ||
| 24 | <form> | 31 | <form> |
| 25 | - <fieldset style = "width:600px"> | ||
| 26 | <legend>방문자 인적 사항</legend> | 32 | <legend>방문자 인적 사항</legend> |
| 27 | - 이름: | 33 | + <p>이름: <input class="form-control" type='text' name='name' placeholder="고길동"> |
| 28 | - <input type='text' name='name' style="width:70px" required/> | 34 | + </p> |
| 29 | - 전화번호: | 35 | + <p>전화번호: <input class="form-control" type='text' name='number' placeholder="010-1234-1234." ></input></p> |
| 30 | - <input type='text' name='number' style="width:250px" placeholder="XXX-XXXX-XXXX 형식으로 입력하세요." required/> | 36 | + <p>신분: |
| 31 | - <div style="display:inline">신분:</div> | 37 | + <select name = "id" class="form-control"> |
| 32 | - <select name = "id" style="width: 50;"> | ||
| 33 | <option value = "재학생">재학생</option> | 38 | <option value = "재학생">재학생</option> |
| 34 | <option value = "휴학생">휴학생</option> | 39 | <option value = "휴학생">휴학생</option> |
| 35 | <option value = "직원">직원</option> | 40 | <option value = "직원">직원</option> |
| 36 | <option value = "외부인">외부인</option> | 41 | <option value = "외부인">외부인</option> |
| 37 | - </select><br><br> | 42 | + </select> |
| 38 | - <input type = "submit" value = "제출"/> | 43 | + </p> |
| 39 | - <input type = "reset" value = "다시입력"/> | 44 | + <p> |
| 40 | - </fieldset> | 45 | + <input type = "reset" style="float:right; margin-left:5px; background-image: linear-gradient(to top, #fbc2eb 0%, #a6c1ee 100%); border: 0;" class="btn btn-warning"value = "다시입력"/> |
| 46 | + <input type = "submit" style="float:right; background-image: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%); border: 0; " class="btn btn-success" value = "제출"/> | ||
| 47 | + </p> | ||
| 41 | </form> | 48 | </form> |
| 49 | + </div> | ||
| 50 | + <!-- 인풋 폼 종료 --> | ||
| 51 | + </div> | ||
| 52 | + </div> | ||
| 53 | + <span id = "check_audio"> | ||
| 54 | + <!--초기값으로 '시작'이라는 음성을 사용 --> | ||
| 55 | + <!--auto play 기능을 위해 iframe 사용 --> | ||
| 56 | + <iframe src="/audios/4.mp3" allow="autoplay" id="audio" style="display:none"></iframe> | ||
| 57 | + </span> | ||
| 58 | + <!-- footer --> | ||
| 59 | + <footer> | ||
| 60 | + <p>Mask-Wearing Discriminate Program Using Teachable Machine 2.0</p> | ||
| 61 | + <p>Using teachable machine 2.0 provided by Google, a model was created that learned the type of mask wearing.</p> | ||
| 62 | + <p>2017103978김태영 20174015이재호</p> | ||
| 63 | + <p>contact us <a href="http://khuhub.khu.ac.kr/MWD/2020-02-OSS-TermProject">khuhub.khu.ac.kr/MWD/2020-02-OSS-TermProject</a></p> | ||
| 64 | + </footer> | ||
| 65 | + | ||
| 66 | + | ||
| 67 | + <!--https://teachablemachine.withgoogle.com/ 를 통해 학습시키고 얻은 스켈레톤 코드 --> | ||
| 42 | <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@1.3.1/dist/tf.min.js"></script> | 68 | <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@1.3.1/dist/tf.min.js"></script> |
| 43 | <script src="https://cdn.jsdelivr.net/npm/@teachablemachine/image@0.8/dist/teachablemachine-image.min.js"></script> | 69 | <script src="https://cdn.jsdelivr.net/npm/@teachablemachine/image@0.8/dist/teachablemachine-image.min.js"></script> |
| 44 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | 70 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> |
| ... | @@ -55,7 +81,7 @@ | ... | @@ -55,7 +81,7 @@ |
| 55 | var last_result_predict=-999; | 81 | var last_result_predict=-999; |
| 56 | 82 | ||
| 57 | // Load the image model and setup the webcam | 83 | // Load the image model and setup the webcam |
| 58 | - async function init() { | 84 | + window.onload = async function init() { |
| 59 | const modelURL = URL + "model.json"; | 85 | const modelURL = URL + "model.json"; |
| 60 | const metadataURL = URL + "metadata.json"; | 86 | const metadataURL = URL + "metadata.json"; |
| 61 | 87 | ||
| ... | @@ -68,7 +94,7 @@ | ... | @@ -68,7 +94,7 @@ |
| 68 | 94 | ||
| 69 | // Convenience function to setup a webcam | 95 | // Convenience function to setup a webcam |
| 70 | const flip = true; // whether to flip the webcam | 96 | const flip = true; // whether to flip the webcam |
| 71 | - webcam = new tmImage.Webcam(200, 200, flip); // width, height, flip | 97 | + webcam = new tmImage.Webcam(550, 550, flip); // width, height, flip |
| 72 | await webcam.setup(); // request access to the webcam | 98 | await webcam.setup(); // request access to the webcam |
| 73 | await webcam.play(); | 99 | await webcam.play(); |
| 74 | window.requestAnimationFrame(loop); | 100 | window.requestAnimationFrame(loop); |
| ... | @@ -126,7 +152,7 @@ | ... | @@ -126,7 +152,7 @@ |
| 126 | 152 | ||
| 127 | //ajax로 서버에 그 id에 해당하는 이미지의 주소와 음성파일을 달라고 요청한다. | 153 | //ajax로 서버에 그 id에 해당하는 이미지의 주소와 음성파일을 달라고 요청한다. |
| 128 | if(predict_id > 0){ | 154 | if(predict_id > 0){ |
| 129 | - //last_result_predict값을 지금 결과로 나옴 predict로 초기화해준다. | 155 | + //last_result_predict값을 지금 결과로 나온 predict로 초기화해준다. |
| 130 | last_result_predict = predict_id; | 156 | last_result_predict = predict_id; |
| 131 | $(function() { | 157 | $(function() { |
| 132 | $.ajax({ | 158 | $.ajax({ |
| ... | @@ -152,7 +178,7 @@ | ... | @@ -152,7 +178,7 @@ |
| 152 | var audio = json_data.audio; | 178 | var audio = json_data.audio; |
| 153 | var audioName = ""; | 179 | var audioName = ""; |
| 154 | //이미지 태그 생성 | 180 | //이미지 태그 생성 |
| 155 | - strDOM += '<img src="'+images+'">'; | 181 | + strDOM += '<img class="alert_image" src="'+images+'">'; |
| 156 | //오디오 태그 생성 | 182 | //오디오 태그 생성 |
| 157 | audioName += '<iframe src="' + audio + '" allow="autoplay" id="audio" style="display:none"></iframe>'; | 183 | audioName += '<iframe src="' + audio + '" allow="autoplay" id="audio" style="display:none"></iframe>'; |
| 158 | //#cehck_image div의 이미지 교체 | 184 | //#cehck_image div의 이미지 교체 | ... | ... |
-
Please register or login to post a comment