Donia&Hanna commited on
Delete plastics-ai
Browse files- plastics-ai/README.md +0 -11
- plastics-ai/static/index.html +0 -53
- plastics-ai/static/style.css +0 -10
plastics-ai/README.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: plastics-ai
|
| 3 |
-
emoji: 🧼
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: pink
|
| 6 |
-
sdk: static
|
| 7 |
-
app_file: static/index.html
|
| 8 |
-
---
|
| 9 |
-
|
| 10 |
-
# Plastics AI
|
| 11 |
-
Plastic recognition using webcam + Teachable Machine.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plastics-ai/static/index.html
DELETED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="en">
|
| 3 |
-
<head>
|
| 4 |
-
<meta charset="UTF-8">
|
| 5 |
-
<title>Plastics AI</title>
|
| 6 |
-
<link rel="stylesheet" href="style.css">
|
| 7 |
-
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>
|
| 8 |
-
<script src="https://cdn.jsdelivr.net/npm/@teachablemachine/image@latest"></script>
|
| 9 |
-
</head>
|
| 10 |
-
<body>
|
| 11 |
-
<h1>Plastic Recognition</h1>
|
| 12 |
-
<button onclick="init()">Start Camera</button>
|
| 13 |
-
<div><video id="webcam" autoplay></video></div>
|
| 14 |
-
<div id="label-container"></div>
|
| 15 |
-
<script type="text/javascript">
|
| 16 |
-
const URL = "./model/";
|
| 17 |
-
let model, webcam, labelContainer, maxPredictions;
|
| 18 |
-
|
| 19 |
-
async function init() {
|
| 20 |
-
const modelURL = URL + "model.json";
|
| 21 |
-
const metadataURL = URL + "metadata.json";
|
| 22 |
-
|
| 23 |
-
model = await tmImage.load(modelURL, metadataURL);
|
| 24 |
-
webcam = new tmImage.Webcam(200, 200, true);
|
| 25 |
-
await webcam.setup();
|
| 26 |
-
await webcam.play();
|
| 27 |
-
window.requestAnimationFrame(loop);
|
| 28 |
-
|
| 29 |
-
document.getElementById("webcam").appendChild(webcam.canvas);
|
| 30 |
-
labelContainer = document.getElementById("label-container");
|
| 31 |
-
maxPredictions = model.getTotalClasses();
|
| 32 |
-
for (let i = 0; i < maxPredictions; i++) {
|
| 33 |
-
labelContainer.appendChild(document.createElement("div"));
|
| 34 |
-
}
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
async function loop() {
|
| 38 |
-
webcam.update();
|
| 39 |
-
await predict();
|
| 40 |
-
window.requestAnimationFrame(loop);
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
async function predict() {
|
| 44 |
-
const prediction = await model.predict(webcam.canvas);
|
| 45 |
-
for (let i = 0; i < maxPredictions; i++) {
|
| 46 |
-
const classPrediction = prediction[i].className + ": " +
|
| 47 |
-
(prediction[i].probability * 100).toFixed(2) + "%";
|
| 48 |
-
labelContainer.childNodes[i].innerHTML = classPrediction;
|
| 49 |
-
}
|
| 50 |
-
}
|
| 51 |
-
</script>
|
| 52 |
-
</body>
|
| 53 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plastics-ai/static/style.css
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
body {
|
| 2 |
-
font-family: sans-serif;
|
| 3 |
-
text-align: center;
|
| 4 |
-
background: #f5f5f5;
|
| 5 |
-
margin: 20px;
|
| 6 |
-
}
|
| 7 |
-
button {
|
| 8 |
-
padding: 10px;
|
| 9 |
-
font-size: 16px;
|
| 10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|