Spaces:
Running
Download DEPLOY_STATIC.md from Mollysc/Topic4APIR: direct link, hf CLI and curl.
- Browser
- Download file 4.07 kB
-
https://huggingface.co/spaces/Mollysc/Topic4APIR/resolve/main/DEPLOY_STATIC.md
- Command line
-
hf download hf://spaces/Mollysc/Topic4APIR/DEPLOY_STATIC.md
-
curl -L -o DEPLOY_STATIC.md https://huggingface.co/spaces/Mollysc/Topic4APIR/resolve/main/DEPLOY_STATIC.md
Static Space 部署说明
中文
这是与 wr92-course/test 相同类型的纯静态部署。图片和模型位于本Space仓库,不使用Dataset;用户上传的识别图片只在浏览器内处理。
- 解压
AI-Powered_Image_Recognition_HF_Static.zip。 - 在现有Space的Files页面上传包内全部文件和文件夹,包括隐藏文件
.gitattributes;保留samples/、models/、vendor/的层级,不要再套一层test。 - 确认根目录README头部为
sdk: static、app_file: index.html。删除旧app.py、server.py、requirements.txt、packages.txt,以及远程仓库若仍存在的旧Dockerfile。不需要GPU维护函数或Python依赖安装。 - 等待Static发布完成,再从App页打开;旧
/lab/地址已退休。浏览器若缓存了旧版本,请刷新一次。 - 在开发者工具Network中检查图片、权重和WASM请求。大文件应能跳转到Hugging Face文件CDN,状态200或206均可能正常。不要把有时效的签名下载地址写进代码。
- 依次核对默认人脸对、一个手势、Lab card OCR及上传图片。比较香港节点时先做一次无缓存加载,再取消Disable cache检查正常第二次访问。
使用Git上传时
.gitattributes 会为样例PNG/JPEG、手势task、无扩展名人脸分片、WASM及语言数据声明大文件规则。已有普通Git文件不会因为新增规则而自动转换;首次迁移需要重新按规则加入这些指定资源,再提交发布。下面命令仅适用于已经安装Git LFS、位于本仓库根目录的情况;先检查自己的暂存区。
# 将现有已跟踪资源按本仓库规则重新归一化;随后加入新资源并检查暂存差异。
git add -- .gitattributes samples models vendor how-to-start.pdf
git add --renormalize -- samples models vendor how-to-start.pdf
git check-attr filter -- samples/face_a.png models/gesture_recognizer.task models/face/face_recognition_model-shard1
# 输出应显示filter为lfs;提交和推送按你的正常发布流程进行。
不能只上传几KB的Git LFS指针文本来代替实际图片或模型。本交付ZIP内包含真实文件。.gitattributes和文件上传完成后仍应核对实际下载请求;本地测试不能证明你的香港线路速度。
本地预览与范围
在本目录运行 python -m http.server 8765 --bind 127.0.0.1,打开 http://127.0.0.1:8765/。当前版本保留原浏览器模型、原有图片、阈值、JSON导出和上传Blob地址生命周期修复;图库扩充为50例,OCR自然图片组含原手写便条和7张新场景图。新图以较小JPEG按需下载,不在首页集中加载。手势仍需WebGL2,本轮不重写图形兼容方案。不要混用旧Gradio或四文件补丁包。
English
Extract the Static ZIP and upload its contents, including .gitattributes, directly to the Space root. Preserve the samples/, models/ and vendor/ folders. Keep sdk: static and app_file: index.html in README. Remove obsolete app.py, server.py, requirements.txt, packages.txt and any old remote Dockerfile. Open the App after Static publishing completes; /lab/ is no longer the application path.
Images and models belong to this Space, not a Dataset. Uploaded inference images stay in the browser. Large-file declarations alone do not migrate existing Git blobs: Git users must normalize and add the selected resources before committing. The ZIP contains complete binary files rather than LFS pointer text. Verify image/model/WASM downloads and actual CDN redirects after uploading; do not hardcode expiring signed URLs.
Check face verification, a gesture, Lab card OCR and uploads. For a Hong Kong route comparison, test a fresh uncached load, then restore normal browser caching. Local validation does not establish performance on that route. The existing gesture model still needs browser WebGL2; this migration removes CPU server fallback without replacing the browser model.