# ๐Ÿš€ Hugging Face Spaces Deployment Guide ## Quick Start ### Option 1: Automated Setup (Recommended) ```bash # 1. Setup the repository python setup_hf_space.py # 2. Push to Hugging Face Spaces python push_to_hf_space.py ``` ### Option 2: Manual Setup Follow the steps below for manual deployment. ## ๐Ÿ“‹ Prerequisites 1. **Git installed** on your system 2. **Hugging Face account** (free) 3. **Python 3.8+** installed 4. **All project files** in the current directory ## ๐ŸŒ Step 1: Create Hugging Face Space 1. Go to [Hugging Face Spaces](https://huggingface.co/spaces) 2. Click **"Create new Space"** 3. Fill in the details: - **Name**: `textilindo-ai-assistant` - **SDK**: **Docker** - **Hardware**: **GPU Basic** (recommended) or **CPU Basic** - **Visibility**: Public or Private 4. Click **"Create Space"** 5. **Copy the repository URL** (e.g., `https://huggingface.co/spaces/your-username/textilindo-ai-assistant`) ## ๐Ÿ”ง Step 2: Setup Git Repository ```bash # Initialize git repository (if not already done) git init # Add your Hugging Face Space as remote git remote add origin https://huggingface.co/spaces/your-username/textilindo-ai-assistant # Verify remote git remote -v ``` ## ๐Ÿ“ Step 3: Prepare Files The following files are already prepared for you: - โœ… `README.md` - Space configuration - โœ… `Dockerfile` - Optimized for HF Spaces - โœ… `requirements.txt` - Fixed dependencies - โœ… `app.py` - Main entry point - โœ… `app_hf_spaces.py` - Web interface - โœ… `health_check.py` - Health monitoring - โœ… All scripts in `scripts/` directory ## ๐Ÿš€ Step 4: Deploy to Hugging Face Spaces ```bash # Add all files to git git add . # Commit changes git commit -m "Initial commit: Textilindo AI Assistant" # Push to Hugging Face Spaces git push origin main ``` ## โณ Step 5: Monitor Build 1. Go to your Hugging Face Space 2. Check the **"Logs"** tab 3. Wait for the build to complete (5-10 minutes) 4. The Space will automatically start when ready ## ๐ŸŽฏ Step 6: Test Your Space 1. **Visit your Space URL**: `https://huggingface.co/spaces/your-username/textilindo-ai-assistant` 2. **Check Health**: Visit `/health` endpoint 3. **Test Interface**: Use the web interface to run scripts 4. **Monitor Logs**: Check for any errors ## โš™๏ธ Step 7: Configure Environment Variables (Optional) In your Space settings, add: - `HUGGINGFACE_TOKEN`: Your Hugging Face token (for model downloads) - `NOVITA_API_KEY`: Your Novita AI API key (for external training) ## ๐Ÿ” Troubleshooting ### Build Failures - Check the build logs in your Space - Verify all files are present - Ensure Dockerfile is in the root directory ### Runtime Errors - Check the Space logs - Verify environment variables - Test individual scripts ### Memory Issues - Use GPU Basic or higher hardware - Consider using smaller models - Check resource usage in logs ## ๐Ÿ“Š Expected Results After successful deployment: โœ… **Space builds** without errors โœ… **Web interface** accessible โœ… **Health endpoint** returns healthy status โœ… **All scripts** executable via interface โœ… **Training process** can be initiated ## ๐ŸŽ‰ Success! Your Textilindo AI Assistant is now deployed on Hugging Face Spaces! ### Features Available: - ๐Ÿค– **AI Model Training** with LoRA - ๐Ÿ“Š **Dataset Creation** and management - ๐Ÿงช **Model Testing** and inference - ๐Ÿ”— **External Service** integration - ๐Ÿ“ฑ **Web Interface** for all operations ### Next Steps: 1. **Test the interface** with sample data 2. **Train your first model** using the web interface 3. **Share your Space** with others 4. **Monitor performance** and logs ## ๐Ÿ“ž Support If you encounter issues: 1. Check the Space logs 2. Verify all files are present 3. Test locally with `python test_build.py` 4. Review the troubleshooting section above ## ๐Ÿ”„ Updates To update your Space: 1. Make changes to your local files 2. Commit and push: `git push origin main` 3. The Space will automatically rebuild 4. Check build logs for any issues