Spaces:
Sleeping
Sleeping
File size: 3,900 Bytes
c87f72b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | # Quick Start Guide
## Initial Setup (First Time)
1. **Run the setup script:**
```bash
bash setup.sh
```
2. **Configure your credentials:**
Edit `.env` file with your credentials:
- Get HuggingFace token from: https://huggingface.co/settings/tokens
- Get Anthropic API key from: https://console.anthropic.com/
3. **Update space names:**
Edit `config.yaml` to set your HuggingFace space names
## Using the Web Interface
```bash
streamlit run app.py
```
Then open your browser to the URL shown (usually http://localhost:8501)
### Web Interface Features:
- **Dashboard**: Overview of your spaces and recent activity
- **AI Agent**: Chat with Claude to get help with code and file management
- **File Manager**: Browse, upload, and manage files
- **Space Sync**: Synchronize files to HuggingFace Spaces
- **Audit & Archive**: Create file inventories and compressed archives
## Using the Command Line
### Run File Audit
```bash
python automation.py audit
```
Creates `inventory.json` and `genesis_archive_*.tar.gz`
### Sync All Configured Spaces
```bash
python automation.py sync
```
Uploads files to all spaces with `auto_sync: true`
### Sync Specific Space
```bash
python automation.py sync-space --space vamguard-titan
```
### Create Backup
```bash
python automation.py backup
```
Backs up everything to mapping-and-inventory space
### Full Automation
```bash
python automation.py full
```
Runs: audit β sync all β backup
## GitHub Actions Setup
For automated syncing via GitHub Actions:
1. **Add secrets to your GitHub repository:**
- Go to Settings β Secrets and variables β Actions
- Add: `HF_TOKEN`, `HF_USERNAME`, `ANTHROPIC_API_KEY`
2. **Push to trigger:**
```bash
git add .
git commit -m "Initial setup"
git push
```
3. **Manual trigger:**
- Go to Actions tab on GitHub
- Select "HuggingFace Space Sync" workflow
- Click "Run workflow"
## Common Tasks
### Create a New HuggingFace Space
**Via Web UI:**
1. Open app: `streamlit run app.py`
2. Navigate to "Space Sync" β "Create Space" tab
3. Enter space name and click "Create Space"
**Via Python:**
```python
from hf_space_sync import HFSpaceSync
sync = HFSpaceSync()
sync.create_space("my-new-space", "streamlit", private=False)
```
### Upload Files to a Space
```python
from hf_space_sync import HFSpaceSync
sync = HFSpaceSync()
sync.upload_files("vamguard-titan", "app.py", commit_message="Update app")
```
### Ask the AI Agent for Help
**Via Web UI:**
1. Open app: `streamlit run app.py`
2. Go to "AI Agent" page
3. Type your question: "How do I organize my Python files?"
**Via Python:**
```python
from app import AIAgent
agent = AIAgent()
response = agent.process_request("Help me sync files to HuggingFace")
print(response)
```
## Troubleshooting
**"Module not found" errors:**
```bash
source venv/bin/activate # Activate virtual environment
pip install -r requirements.txt
```
**HuggingFace authentication errors:**
- Check `.env` file has correct `HF_TOKEN`
- Verify token at https://huggingface.co/settings/tokens
- Ensure token has write permissions
**AI Agent not responding:**
- Verify `ANTHROPIC_API_KEY` in `.env`
- Check API key at https://console.anthropic.com/
- Ensure you have API credits
## File Locations
- **Configuration**: `config.yaml`
- **Environment**: `.env`
- **Logs**: `automation_log_*.txt`
- **Reports**: `automation_report_*.json`
- **Inventories**: `inventory.json`
- **Archives**: `genesis_archive_*.tar.gz`
## Getting Help
- Check the full README.md for detailed documentation
- Review logs in `automation_log_*.txt`
- Open an issue on GitHub
- Use the AI Agent in the web interface
## Next Steps
1. Customize `config.yaml` for your needs
2. Add more spaces to the configuration
3. Set up GitHub Actions for automation
4. Explore the AI Agent capabilities
5. Create scheduled backups
Happy coding! π
|