Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- app_security.log +3 -0
- hf_deploy/DEPLOYMENT_GUIDE.md +104 -0
- hf_deploy/app.py +0 -0
app_security.log
CHANGED
|
@@ -16,3 +16,6 @@
|
|
| 16 |
2025-09-24 15:31:28,704 - app - INFO - Created directory with permissions 0o755: Generated
|
| 17 |
2025-09-24 15:31:28,704 - app - INFO - Created directory with permissions 0o755: static
|
| 18 |
2025-09-24 15:31:28,704 - app - INFO - Created directory with permissions 0o755: view_session
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
2025-09-24 15:31:28,704 - app - INFO - Created directory with permissions 0o755: Generated
|
| 17 |
2025-09-24 15:31:28,704 - app - INFO - Created directory with permissions 0o755: static
|
| 18 |
2025-09-24 15:31:28,704 - app - INFO - Created directory with permissions 0o755: view_session
|
| 19 |
+
2025-09-24 16:42:54,206 - httpx - INFO - HTTP Request: GET http://127.0.0.1:7860/gradio_api/startup-events "HTTP/1.1 200 OK"
|
| 20 |
+
2025-09-24 16:42:54,291 - httpx - INFO - HTTP Request: HEAD http://127.0.0.1:7860/ "HTTP/1.1 200 OK"
|
| 21 |
+
2025-09-24 16:42:54,712 - httpx - INFO - HTTP Request: GET https://api.gradio.app/pkg-version "HTTP/1.1 200 OK"
|
hf_deploy/DEPLOYMENT_GUIDE.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# HuggingFace Spaces Deployment Guide
|
| 2 |
+
|
| 3 |
+
## Overview
|
| 4 |
+
This package contains a complete, deployment-ready version of BytePlus Image Generation Studio with fixes for directory access and view_session functionality.
|
| 5 |
+
|
| 6 |
+
## Package Contents
|
| 7 |
+
- `hf_app.py` - Main HuggingFace launcher (replaces app.py)
|
| 8 |
+
- `app.py` - Modified BytePlus application with all fixes
|
| 9 |
+
- `requirements.txt` - Python dependencies
|
| 10 |
+
- `README.md` - HuggingFace Space description
|
| 11 |
+
- `.gitignore` / `.gitattributes` - Git configuration
|
| 12 |
+
- `Assets/` - Sample images (Cyberpunk.jpg, Ghibli.jpg, Picasso.jpg, VanGogh.jpg)
|
| 13 |
+
- `Generated/`, `static/`, `view_session/` - Pre-created directories
|
| 14 |
+
|
| 15 |
+
## Deployment Steps
|
| 16 |
+
|
| 17 |
+
### 1. Create New HuggingFace Space
|
| 18 |
+
- Go to https://huggingface.co/new-space
|
| 19 |
+
- Choose "Gradio" as SDK
|
| 20 |
+
- Set visibility as desired
|
| 21 |
+
- Create the space
|
| 22 |
+
|
| 23 |
+
### 2. Upload Files
|
| 24 |
+
Upload ALL files from this `hf_deploy/` directory to your HuggingFace Space:
|
| 25 |
+
- Use the web interface "Add file" β "Upload files"
|
| 26 |
+
- Or clone the repo and push via Git
|
| 27 |
+
- **Important**: Make sure `hf_app.py` is renamed to `app.py` in the Space (HF requires main file to be `app.py`)
|
| 28 |
+
|
| 29 |
+
### 3. File Renaming (Critical)
|
| 30 |
+
Once uploaded to HuggingFace:
|
| 31 |
+
1. Rename `hf_app.py` β `app.py` (this becomes the main launcher)
|
| 32 |
+
2. Rename `app.py` β `bytePlus_app.py` (this is the core application)
|
| 33 |
+
|
| 34 |
+
### 4. Verify Deployment
|
| 35 |
+
After files upload, HuggingFace will automatically:
|
| 36 |
+
- Install dependencies from `requirements.txt`
|
| 37 |
+
- Run `app.py` (which is now the `hf_app.py` launcher)
|
| 38 |
+
- Create necessary directories with proper permissions
|
| 39 |
+
- Launch the BytePlus application
|
| 40 |
+
|
| 41 |
+
## Key Features Fixed
|
| 42 |
+
|
| 43 |
+
### β
Directory Creation
|
| 44 |
+
- Automatically creates `Generated/`, `static/`, `view_session/` folders
|
| 45 |
+
- Sets proper permissions (755) for all directories
|
| 46 |
+
- No manual permission fixes needed
|
| 47 |
+
|
| 48 |
+
### β
View Session Functionality
|
| 49 |
+
- Fixed `/view_session/{timestamp}` route
|
| 50 |
+
- Proper file URL mapping with `/files/` prefix
|
| 51 |
+
- Comprehensive error handling
|
| 52 |
+
- Modern, responsive HTML interface
|
| 53 |
+
- ZIP download for all session images
|
| 54 |
+
|
| 55 |
+
### β
File Serving
|
| 56 |
+
- Proper StaticFiles mounting for all directories
|
| 57 |
+
- Direct file access via `/files/` URLs
|
| 58 |
+
- Support for PNG, JPG, JPEG, GIF, WEBP formats
|
| 59 |
+
|
| 60 |
+
## Testing the Deployment
|
| 61 |
+
|
| 62 |
+
### 1. Basic Functionality
|
| 63 |
+
- Generate some images using the interface
|
| 64 |
+
- Check that images appear in the gallery
|
| 65 |
+
- Verify download functionality works
|
| 66 |
+
|
| 67 |
+
### 2. View Session Feature
|
| 68 |
+
- Generate images (creates session folder)
|
| 69 |
+
- Click "View Generated Images" button
|
| 70 |
+
- Should redirect to `/view_session/{timestamp}`
|
| 71 |
+
- Verify all images display correctly
|
| 72 |
+
- Test "Download All Images" ZIP functionality
|
| 73 |
+
|
| 74 |
+
### 3. Direct URL Access
|
| 75 |
+
- Try accessing: `https://your-space.hf.space/view_session/YYYYMMDD_HHMMSS`
|
| 76 |
+
- Should show session gallery with all images
|
| 77 |
+
- Images should load without errors
|
| 78 |
+
|
| 79 |
+
## Troubleshooting
|
| 80 |
+
|
| 81 |
+
### Images Not Loading
|
| 82 |
+
- Check browser console for 404 errors
|
| 83 |
+
- Verify files exist in correct directories
|
| 84 |
+
- Ensure StaticFiles routes are working
|
| 85 |
+
|
| 86 |
+
### Permission Errors
|
| 87 |
+
- Should be automatically fixed by `hf_app.py` launcher
|
| 88 |
+
- Directories created with 755 permissions
|
| 89 |
+
- No manual intervention needed
|
| 90 |
+
|
| 91 |
+
### View Session Not Working
|
| 92 |
+
- Check that session folders are created in `view_session/`
|
| 93 |
+
- Verify timestamp format: `YYYYMMDD_HHMMSS`
|
| 94 |
+
- Check that images are copied to session folder
|
| 95 |
+
|
| 96 |
+
## Support
|
| 97 |
+
If issues persist:
|
| 98 |
+
1. Check HuggingFace Space logs
|
| 99 |
+
2. Verify all files uploaded correctly
|
| 100 |
+
3. Ensure file renaming completed properly
|
| 101 |
+
4. Test locally first using original structure
|
| 102 |
+
|
| 103 |
+
---
|
| 104 |
+
**Ready to Deploy**: This package is complete and tested for HuggingFace Spaces deployment.
|
hf_deploy/app.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|