test / index.html
miyuki17's picture
feat(course): implement separate EN 中文 student UI and accessible toggle
97efb9d verified
Raw History Blame Contribute Delete
12.4 kB
<!doctype html>
<html lang="en" data-wr92-course="det">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta
name="description"
content="AI-Powered Object Detection mini-lab using COCO examples and a pretrained model"
/>
<title>AI-Powered Object Detection</title>
<link
rel="icon"
href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🔎</text></svg>"
/>
<link rel="stylesheet" href="./style.css" />
<style id="wr92-shared-classroom-nav">
.wr92-course-nav{max-width:1160px;margin:12px auto 0;padding:16px 18px;border:1px solid #dce4f0;border-radius:16px;background:#f8fbff;color:#243047;font-family:system-ui,-apple-system,sans-serif;line-height:1.5}
.wr92-course-nav strong{font-size:0.97rem}
.wr92-course-nav .wr92-nav-row{display:flex;flex-wrap:wrap;gap:8px;margin:9px 0 12px}
.wr92-course-nav a{display:inline-block;padding:7px 10px;border:1px solid #dae2ee;border-radius:9px;background:#fff;color:#1644a3;text-decoration:none;font-size:0.84rem}
.wr92-course-nav a:hover,.wr92-course-nav a:focus-visible{background:#e6efff;text-decoration:underline}
.wr92-course-nav a[aria-current="page"]{border-color:#3d70d2;background:#eaf1ff;font-weight:700}
.wr92-course-nav p{font-size:0.88rem;margin:5px 0;color:#405169}
.wr92-course-nav .wr92-cap{border-top:1px solid #dce4f0;padding-top:10px}
</style>
<link rel="stylesheet" href="./wr92-language.css">
<script defer src="./wr92-language.js"></script>
</head>
<body>
<div class="wr92-language-toolbar" role="group" aria-label="Language / 语言">
<button type="button" data-wr92-lang="en" aria-pressed="true" disabled>EN</button>
<button type="button" data-wr92-lang="zh" aria-pressed="false" disabled>中文</button>
</div>
<main class="page-shell">
<section class="wr92-course-nav" aria-label="WR92 Course links and usage limits"><strong>WR92 Course · Related learning spaces</strong><nav class="wr92-nav-row" aria-label="Switch between course demos"><a href="https://huggingface.co/spaces/wr92-course/README" target="_top" rel="noopener noreferrer">WR92 Course</a><a href="https://huggingface.co/spaces/wr92-course/test" target="_top" rel="noopener noreferrer" aria-current="page">Object Detection</a><a href="https://huggingface.co/spaces/wr92-course/image-generation-lab" target="_top" rel="noopener noreferrer">Image Generation Lab</a><a href="https://huggingface.co/spaces/miyuki17/creative-technology-image-generation" target="_top" rel="noopener noreferrer">SDXL Turbo · GPU</a><a href="https://huggingface.co/spaces/miyuki17/creative-technology-sana-sprint" target="_top" rel="noopener noreferrer">SANA-Sprint · GPU</a></nav><div class="wr92-cap"><strong>No Hugging Face GPU needed</strong><p>Object detection runs in your browser. Hugging Face ZeroGPU minutes and image-generation call caps do NOT apply here. Your device, model downloads, network, and platform availability can still limit usage. <a href="https://huggingface.co/docs/hub/spaces-zerogpu" target="_blank" rel="noopener noreferrer">HF ZeroGPU policy ↗</a></p></div></section>
<nav class="guide-linkbar" aria-label="Course guide">
<span>Building your own AI mini app?</span>
<a href="./how-to-start.html">How to Start <span aria-hidden="true">→</span></a>
<a href="https://huggingface.co/spaces/wr92-course/image-generation-lab" rel="noopener noreferrer">Image Generation <span aria-hidden="true">↗</span></a>
</nav>
<!-- =========================================================
HERO
========================================================== -->
<header class="hero">
<p class="eyebrow">
Creative Technology · Computer Vision
</p>
<h1>
AI-Powered<br />
Object Detection
</h1>
<p class="lede">
Pick a COCO example or upload your own image.
Then choose a pretrained detector and let AI answer:
<strong>
what objects are here, and where are they?
</strong>
</p>
<div
class="lesson-strip"
aria-label="Mini-lab overview"
>
<span>
<b>Task</b>
Object detection
</span>
<span>
<b>Data</b>
COCO validation examples
</span>
<span>
<b>Models</b>
RT-DETR · DETR · YOLOS Tiny
</span>
</div>
</header>
<!-- =========================================================
MAIN WORKSPACE
========================================================== -->
<section
class="workspace"
aria-label="Object detection mini-lab"
>
<!-- =======================================================
LEFT: CONTROLS
======================================================== -->
<div class="controls card">
<!-- STEP 1 -->
<div class="step">
<span class="step-number">
1
</span>
<div>
<p class="control-label sample-title">
Choose an image
</p>
<p class="helper">
Start with a tested COCO example,
or try a photo of your own.
</p>
</div>
</div>
<!-- COCO EXAMPLES -->
<div class="sample-head coco-head">
<div>
<p class="input-kicker">
Start here · COCO examples
</p>
<p class="helper">
Four images are drawn at random
from 100 bundled COCO validation examples.
</p>
</div>
<button
id="shuffle-examples"
class="shuffle-button"
type="button"
>
Shuffle
</button>
</div>
<div
id="sample-grid"
class="sample-grid"
aria-label="COCO example images"
></div>
<!-- OR -->
<div class="or-row">
<span>
or try your own
</span>
</div>
<!-- IMAGE UPLOAD -->
<label
class="control-label"
for="image-input"
>
Upload an image
</label>
<p class="helper">
Useful for seeing where the model
generalizes well—and where it does not.
</p>
<input
id="image-input"
class="file-input"
type="file"
accept="image/*"
/>
<div class="divider"></div>
<!-- STEP 2 -->
<div class="step">
<span class="step-number">
2
</span>
<div class="grow">
<label
class="control-label"
for="model-select"
>
Choose detector
</label>
<select
id="model-select"
class="model-select"
></select>
<p
id="model-note"
class="helper"
>
RT-DETR is the recommended classroom default.
</p>
</div>
</div>
<div class="divider"></div>
<!-- STEP 3 -->
<div class="step">
<span class="step-number">
3
</span>
<div class="grow">
<div class="slider-row">
<label
class="control-label"
for="threshold"
>
Confidence threshold
</label>
<output
id="threshold-value"
for="threshold"
>
0.50
</output>
</div>
<input
id="threshold"
type="range"
min="0.10"
max="0.95"
value="0.50"
step="0.05"
/>
<p class="helper">
Higher values only keep predictions
the model is more confident about.
</p>
</div>
</div>
<!-- RUN BUTTON -->
<button
id="run-button"
class="run-button"
type="button"
disabled
>
Run AI Detection
</button>
<!-- STATUS -->
<p
id="status"
class="status"
aria-live="polite"
>
Choose a COCO example or upload your own image.
</p>
<!-- PROGRESS -->
<div
id="progress-wrap"
class="progress-wrap"
hidden
>
<div
id="progress-bar"
class="progress-bar"
></div>
</div>
</div>
<!-- =======================================================
RIGHT: RESULT
======================================================== -->
<div class="result card">
<div class="result-head">
<div>
<p class="section-kicker">
AI prediction
</p>
<h2>
What did the detector find?
</h2>
</div>
<span
id="runtime-badge"
class="badge"
>
Waiting
</span>
</div>
<!-- RESULT CANVAS -->
<div
id="canvas-wrap"
class="canvas-wrap empty"
>
<canvas
id="result-canvas"
aria-label="Detection result"
></canvas>
<p id="canvas-placeholder">
Choose an image first.
The original image appears here before detection.
</p>
</div>
<!-- SUMMARY -->
<div
id="summary"
class="summary"
>
No detections yet.
</div>
<!-- DETECTION TABLE -->
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Object</th>
<th>Confidence</th>
<th>Bounding box</th>
</tr>
</thead>
<tbody id="detections-body">
<tr class="empty-row">
<td colspan="3">
Run the detector to see details.
</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<!-- =========================================================
EXPLANATION
========================================================== -->
<section class="explain card">
<p class="section-kicker">
What you are doing
</p>
<h2 class="explain-title">
Use a learned AI capability instead of rebuilding
the traditional task from scratch.
</h2>
<p class="explain-copy">
COCO contains everyday-object images with annotations.
The selected pretrained detector has already learned
the object-detection task from labeled data.
In this mini-lab, you can switch models and compare
how their predictions differ on the same image.
</p>
<div
class="flow"
aria-label="Object detection flow"
>
<span>
COCO example or your image
</span>
<span class="arrow">
→
</span>
<span>
Selected pretrained detector
</span>
<span class="arrow">
→
</span>
<span>
Boxes + labels + confidence
</span>
</div>
<p class="extension-note">
<strong>
Compare models:
</strong>
keep the image fixed,
switch detector,
and observe how predictions,
confidence,
and speed change.
</p>
</section>
<!-- =========================================================
FOOTER
========================================================== -->
<footer>
Hosted as a Hugging Face Static Space ·
Powered by Transformers.js
</footer>
</main>
<!-- ===========================================================
APP
============================================================ -->
<script
type="module"
src="./app.js"
></script>
</body>
</html>