Spaces:
Running
Running
Ali Mohsin
commited on
Commit
Β·
f1defd8
1
Parent(s):
227af5e
Add Hugging Face setup documentation and security improvements
Browse files- README_HF_SETUP.md +60 -0
README_HF_SETUP.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Hugging Face Setup Guide
|
| 2 |
+
|
| 3 |
+
## π Setting Up Hugging Face Authentication
|
| 4 |
+
|
| 5 |
+
### 1. Get Your HF Token
|
| 6 |
+
- Go to https://huggingface.co/settings/tokens
|
| 7 |
+
- Create a new token with **Write** permissions
|
| 8 |
+
- Copy the token (starts with `hf_...`)
|
| 9 |
+
|
| 10 |
+
### 2. Set Environment Variables
|
| 11 |
+
|
| 12 |
+
#### Option A: In Hugging Face Spaces (Recommended)
|
| 13 |
+
1. Go to your Space settings
|
| 14 |
+
2. Add these secrets:
|
| 15 |
+
- `HF_TOKEN`: Your Hugging Face token
|
| 16 |
+
- `HF_USERNAME`: Your Hugging Face username (e.g., "Stylique")
|
| 17 |
+
|
| 18 |
+
#### Option B: Local Development
|
| 19 |
+
```bash
|
| 20 |
+
export HF_TOKEN="hf_your_token_here"
|
| 21 |
+
export HF_USERNAME="your_username"
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
### 3. Verify Setup
|
| 25 |
+
```bash
|
| 26 |
+
source setup_hf.sh
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
## π What Happens Next
|
| 30 |
+
|
| 31 |
+
Once environment variables are set, the system will automatically:
|
| 32 |
+
- β
Authenticate with Hugging Face
|
| 33 |
+
- β
Upload trained models to `{HF_USERNAME}/dressify-models`
|
| 34 |
+
- β
Upload datasets to `{HF_USERNAME}/Dressify-Helper`
|
| 35 |
+
- β
Create repositories if they don't exist
|
| 36 |
+
|
| 37 |
+
## π Security Notes
|
| 38 |
+
|
| 39 |
+
- **Never commit tokens to git**
|
| 40 |
+
- **Use environment variables or HF Spaces secrets**
|
| 41 |
+
- **Tokens are automatically masked in logs**
|
| 42 |
+
|
| 43 |
+
## π Repository Structure
|
| 44 |
+
|
| 45 |
+
After successful upload:
|
| 46 |
+
```
|
| 47 |
+
{HF_USERNAME}/dressify-models/
|
| 48 |
+
βββ resnet_item_embedder_best.pth
|
| 49 |
+
βββ vit_outfit_model_best.pth
|
| 50 |
+
βββ resnet_metrics.json
|
| 51 |
+
βββ vit_metrics.json
|
| 52 |
+
|
| 53 |
+
{HF_USERNAME}/Dressify-Helper/
|
| 54 |
+
βββ train.json
|
| 55 |
+
βββ valid.json
|
| 56 |
+
βββ test.json
|
| 57 |
+
βββ outfit_triplets_train.json
|
| 58 |
+
βββ outfit_triplets_valid.json
|
| 59 |
+
βββ outfit_triplets_test.json
|
| 60 |
+
```
|