harismlnaslm commited on
Commit
ccacd18
Β·
1 Parent(s): 2754850

Add access token setup guide for HuggingFace API integration

Browse files
Files changed (1) hide show
  1. ACCESS_TOKEN_SETUP.md +113 -0
ACCESS_TOKEN_SETUP.md ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # πŸ”‘ HuggingFace Access Token Setup
2
+
3
+ ## βœ… **Yes, your access token is perfect!**
4
+
5
+ Your HuggingFace access token is exactly what you need for the AI integration.
6
+
7
+ ## πŸš€ **Setup Steps:**
8
+
9
+ ### **1. Add Access Token to Your Space:**
10
+
11
+ 1. **Go to your space settings:**
12
+ ```
13
+ https://huggingface.co/spaces/harismlnaslm/Textilindo-AI/settings
14
+ ```
15
+
16
+ 2. **Scroll down to "Environment Variables"**
17
+
18
+ 3. **Add new environment variable:**
19
+ - **Name:** `HUGGINGFACE_API_KEY`
20
+ - **Value:** `your_access_token_here` (paste your token)
21
+ - **Description:** `HuggingFace API key for AI responses`
22
+
23
+ 4. **Click "Save"**
24
+
25
+ ### **2. Restart Your Space:**
26
+ - After adding the token, restart your space
27
+ - Go to the "Settings" tab
28
+ - Click "Restart this Space"
29
+
30
+ ### **3. Test the AI Integration:**
31
+
32
+ ```bash
33
+ # Test 1: Operating hours
34
+ curl -X POST "https://harismlnaslm-Textilindo-AI.hf.space/chat" \
35
+ -H "Content-Type: application/json" \
36
+ -d '{"message": "Jam berapa Textilindo buka?"}'
37
+
38
+ # Test 2: Location
39
+ curl -X POST "https://harismlnaslm-Textilindo-AI.hf.space/chat" \
40
+ -H "Content-Type: application/json" \
41
+ -d '{"message": "dimana lokasi textilindo?"}'
42
+
43
+ # Test 3: Shipping
44
+ curl -X POST "https://harismlnaslm-Textilindo-AI.hf.space/chat" \
45
+ -H "Content-Type: application/json" \
46
+ -d '{"message": "apa ada gratis ongkir?"}'
47
+ ```
48
+
49
+ ## 🎯 **Expected Results After Setup:**
50
+
51
+ ### **Before (Current - Mock Responses):**
52
+ ```json
53
+ {
54
+ "message": "Jam berapa Textilindo buka?",
55
+ "response": "Textilindo berkantor pusat di Jl. Raya Prancis...",
56
+ "status": "success"
57
+ }
58
+ ```
59
+
60
+ ### **After (With Access Token - Real AI):**
61
+ ```json
62
+ {
63
+ "message": "Jam berapa Textilindo buka?",
64
+ "response": "Jam operasional Senin-Jumat 08:00-17:00, Sabtu 08:00-12:00.",
65
+ "status": "success"
66
+ }
67
+ ```
68
+
69
+ ## πŸ” **Verify Setup:**
70
+
71
+ ### **Check if token is working:**
72
+ ```bash
73
+ curl "https://harismlnaslm-Textilindo-AI.hf.space/health"
74
+ ```
75
+
76
+ Should return:
77
+ ```json
78
+ {
79
+ "status": "healthy",
80
+ "timestamp": "2024-10-25T...",
81
+ "hardware": "2 vCPU, 16 GB RAM"
82
+ }
83
+ ```
84
+
85
+ ## πŸš€ **Training Your Model (Optional):**
86
+
87
+ Once the access token is working, you can train your own model:
88
+
89
+ ```bash
90
+ # Start training
91
+ curl -X POST "https://harismlnaslm-Textilindo-AI.hf.space/api/train/start" \
92
+ -H "Content-Type: application/json" \
93
+ -d '{
94
+ "model_name": "distilgpt2",
95
+ "dataset_path": "data/lora_dataset_20250910_145055.jsonl",
96
+ "max_samples": 20,
97
+ "epochs": 1
98
+ }'
99
+
100
+ # Monitor progress
101
+ curl "https://harismlnaslm-Textilindo-AI.hf.space/api/train/status"
102
+ ```
103
+
104
+ ## βœ… **Success Indicators:**
105
+
106
+ - βœ… **Different responses** for different questions
107
+ - βœ… **Relevant answers** that match the questions
108
+ - βœ… **No more template responses**
109
+ - βœ… **Real AI intelligence**
110
+
111
+ ## πŸŽ‰ **Your Access Token is Perfect!**
112
+
113
+ Just add it to your space environment variables and you'll have real AI responses! πŸš€