Spaces:
Running
Running
Download how-to-start.html from Mollysc/Topic5APIC: direct link, hf CLI and curl.
- Browser
- Download file 4.98 kB
-
https://huggingface.co/spaces/Mollysc/Topic5APIC/resolve/main/how-to-start.html
- Command line
-
hf download hf://spaces/Mollysc/Topic5APIC/how-to-start.html
-
curl -L -o how-to-start.html https://huggingface.co/spaces/Mollysc/Topic5APIC/resolve/main/how-to-start.html
4.98 kB
| <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>How to Start · Image Captioning</title><link rel="stylesheet" href="./style.css"><link rel="stylesheet" href="./captioning.css"></head> | |
| <body><main class="page-shell"> | |
| <nav class="guide-linkbar"><span>Image Captioning · Student guide</span><a href="./index.html">← Back to the demo</a></nav> | |
| <header class="hero"><p class="eyebrow">Creative Technology · Build your own AI mini app</p><h1>How to Start</h1><p class="lede">Run a pretrained captioner, understand its output, and build one useful improvement.</p></header> | |
| <section class="card guide-section"><h2>1. Explore the demo</h2><ol><li>Choose one of the example images or upload a PNG, JPEG, or WebP image.</li><li>Start with ViT-GPT2 and select <strong>Run AI Captioning</strong>.</li><li>Allow time for the first model download. Subsequent runs can reuse cached files. Use <strong>Stop this run</strong> if needed.</li><li>Read the caption and check its objects, actions, and relationships against the image.</li><li>Keep the same image and try Florence-2 or SmolVLM. Compare the actual sentences in the log.</li></ol></section> | |
| <section class="card guide-section"><h2>2. Change one thing</h2><p>Florence-2 supports short and detailed captioning tasks. SmolVLM accepts a description instruction. ViT-GPT2 produces a short caption without an instruction. The output-token limit is not a target word count.</p><p>Choose one experiment: compare models, change the requested detail, or crop an image. Record both successes and failures. Download the comparison log before reloading the page.</p></section> | |
| <section class="card guide-section"><h2>3. Make your own Hugging Face Space</h2><ol><li>Sign in to Hugging Face and open this project's Space page.</li><li>Use the Space menu to duplicate it into your own account. Alternatively, create a new <strong>Static</strong> Space and upload this folder's files with their subfolders.</li><li>Keep <code>sdk: static</code> and <code>app_file: index.html</code> in the README metadata.</li><li>Wait for the Space to build, open its App tab, and test one example and one uploaded image.</li></ol><p>This project needs no API key, paid inference endpoint, or training job. Internet access is required to obtain the library and model files.</p></section> | |
| <section class="card guide-section"><h2>4. Find the code that matters</h2><div class="table-wrap"><table><thead><tr><th>File</th><th>What to change</th></tr></thead><tbody><tr><td>index.html</td><td>The task explanation and page structure.</td></tr><tr><td>app.js</td><td>Image selection, result display, and comparison records.</td></tr><tr><td>models.js</td><td>Model IDs, pinned revisions, and task settings.</td></tr><tr><td>captioner.js</td><td>Load the model, prepare inputs, generate tokens, decode the caption.</td></tr><tr><td>caption-worker.js</td><td>Run inference separately so the page stays responsive.</td></tr><tr><td>examples/</td><td>Teaching images, manifest, and source records.</td></tr></tbody></table></div><p>When changing a model, check its Transformers.js support and input format. A Python model ID cannot always be substituted directly.</p></section> | |
| <section class="card guide-section"><h2>5. Explain and submit</h2><ul><li>A working public Space URL and a short explanation of the app's purpose.</li><li>The model ID and an explanation of the image → features → text process.</li><li>At least one successful example and one difficult or incorrect description.</li><li>One controlled comparison with its images, settings, and unchanged generated captions.</li><li>Image sources and a note on limitations. Training a model is optional.</li></ul></section> | |
| <section class="card guide-section"><h2>If something does not work</h2><p><strong>Model download fails:</strong> check access to Hugging Face and jsDelivr, then retry. The first run loads roughly a few hundred MB per model.</p><p><strong>Generation is slow:</strong> use a recent desktop browser, close memory-heavy tabs, choose a shorter output limit, or stop the run. Loading time is shown separately from generation time.</p><p><strong>The sentence is wrong:</strong> save the actual output and identify the unsupported detail. Try another model or a clearer image; a fluent sentence is not a guarantee of correctness.</p><p><strong>Local files do not load:</strong> serve the folder over HTTP instead of opening index.html with file://.</p><pre><code>python -m http.server 7860</code></pre><p>Open <code>http://localhost:7860</code>. Uploaded images are processed in your browser. They are not sent to an inference server.</p><p><a href="./examples/SOURCES.md">Example image sources</a> · <a href="https://huggingface.co/docs/transformers.js">Transformers.js documentation</a></p></section> | |
| <footer>AI-Powered Image Captioning · Student guide</footer> | |
| </main></body></html> | |