Spaces:
network01
/
Runtime error

akhaliq HF Staff commited on
Commit
3d9f57c
·
1 Parent(s): ba8977c

Fix backend_deploy: Let HuggingFace auto-create README, only add anycoder tag

Browse files

Issue: Previously was creating README with hardcoded SDK version (4.44.1)
Fix: Follow the original deploy.py pattern

Changes:
- Removed create_minimal_readme() function - not needed
- Don't manually create or upload README.md during deployment
- Let HuggingFace automatically generate README.md with proper defaults
- After deployment, only modify the auto-generated README to add:
* tags: anycoder (preserves all existing content)
* app_port: 7860 (only for Docker spaces)

Deployment flow now:
1. Parse code based on language (html, gradio, streamlit, react, etc.)
2. Write code files to temp directory (no README)
3. Create space with create_repo() - HF auto-generates README
4. Upload files with upload_folder()
5. Wait 2 seconds for README generation
6. Call add_anycoder_tag_to_readme() to modify existing README
7. Preserves all HF defaults (versions, metadata, etc.)

This ensures:
- No hardcoded versions (HF uses latest compatible versions)
- Existing README content is preserved
- Only adds anycoder attribution tag
- Works with all SDK types (static, gradio, docker)

1 file changed +89 -47
backend_deploy.py+89-47