Spaces:
Runtime error
Runtime error
A newer version of the Streamlit SDK is available:
1.51.0
π Hugging Face Spaces Deployment Guide
This guide will help you deploy the Enhanced Concrete Creep Prediction app to Hugging Face Spaces.
π Prerequisites
- Hugging Face Account: Create an account at huggingface.co
- Git LFS: Install Git Large File Storage for handling model files
- Git: Standard Git installation
π οΈ Deployment Steps
Step 1: Create a New Space
- Go to Hugging Face Spaces
- Click "Create new Space"
- Configure your space:
- Name:
concrete-creep-prediction(or your preferred name) - License: MIT
- SDK: Streamlit
- Hardware: CPU Basic (free tier) or CPU Upgrade/GPU for better performance
- Name:
Step 2: Clone Your New Space
git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
cd YOUR_SPACE_NAME
Step 3: Copy Files from Deploy Directory
Copy all files from the deploy/ directory to your cloned space:
# Copy all files from deploy directory
cp /path/to/your/deploy/* ./
# Ensure executable permissions
chmod +x start_app.sh
Step 4: Initialize Git LFS
git lfs install
git lfs track "*.pt"
git lfs track "*.pkl"
Step 5: Add and Commit Files
git add .
git commit -m "Initial deployment of Enhanced Concrete Creep Prediction app"
git push
π Required Files Structure
Your Hugging Face Space should contain:
your-space/
βββ app.py # Main Streamlit app
βββ lllm_model_all_token.py # Model architecture
βββ requirements.txt # Dependencies
βββ README.md # Space description (with metadata)
βββ .gitattributes # Git LFS configuration
βββ best_llm_model-17.pt # Primary model (LFS)
βββ final_llm_model-5.pt # Alternative model (LFS)
βββ scalers/ # Scaler files (LFS)
βββ feature_scaler.pkl
βββ creep_scaler.pkl
βββ time_values.pkl
βοΈ Configuration Files
requirements.txt
streamlit
pandas
numpy
torch
matplotlib
scikit-learn
pickle-mixin
.gitattributes
*.pt filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
README.md Header
---
title: Enhanced Concrete Creep Prediction
emoji: ποΈ
colorFrom: blue
colorTo: green
sdk: streamlit
sdk_version: 1.28.0
app_file: app.py
pinned: false
license: mit
---
π¨ Important Notes
File Size Considerations
- Model files (~12MB each) require Git LFS
- Total space size should be under Hugging Face limits
- Consider using CPU Basic for free deployment
Performance Optimization
- Remove unused model files if space is limited
- The app automatically detects available models
- CPU inference is sufficient for most use cases
Memory Management
- Hugging Face Spaces have memory limits
- The app is optimized for cloud deployment
- Consider reducing default time points if needed
π§ Troubleshooting
Common Issues:
Git LFS Issues
git lfs install git lfs migrate import --include="*.pt,*.pkl"Build Failures
- Check requirements.txt format
- Ensure all files are properly committed
- Verify Python package compatibility
Memory Errors
- Upgrade to CPU Upgrade hardware
- Reduce model complexity in app.py
- Optimize batch sizes
Model Loading Errors
- Verify Git LFS is working
- Check file paths in app.py
- Ensure proper file permissions
π― Optimization Tips
For Better Performance:
- Upgrade Hardware: Consider CPU Upgrade or GPU for faster inference
- Caching: Streamlit caching is already implemented
- Model Selection: Keep only the best performing model file
- Time Points: Limit default prediction range for faster response
For Reliability:
- Error Handling: Comprehensive error handling is included
- Fallbacks: Multiple model loading strategies
- User Feedback: Clear status messages and warnings
π Monitoring
After deployment, monitor:
- Build Logs: Check for any deployment issues
- Runtime Logs: Monitor app performance
- User Feedback: Gather usage statistics
- Resource Usage: Track memory and compute usage
π Updates
To update your deployed app:
# Make changes locally
git add .
git commit -m "Update: [description of changes]"
git push
Hugging Face Spaces will automatically rebuild and redeploy.
π Support
- Hugging Face Docs: huggingface.co/docs/hub/spaces
- Community: Hugging Face Discord and Forums
- Issues: Create issues in your space repository
Ready to Deploy! π
Your Enhanced Concrete Creep Prediction app will be available at:
https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME