JatsTheAIGen commited on
Commit
61782c5
·
1 Parent(s): 40b87ab

Add HF Spaces URL format guide with troubleshooting

Browse files
Files changed (1) hide show
  1. HF_SPACES_URL_GUIDE.md +87 -0
HF_SPACES_URL_GUIDE.md ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Hugging Face Spaces URL Format Guide
2
+
3
+ ## Correct URL Format
4
+
5
+ For the space `JatinAutonomousLabs/Research_AI_Assistant_API`, the correct URL format is:
6
+
7
+ ### Primary URL (with hyphens):
8
+ ```
9
+ https://jatinautonomouslabs-research-ai-assistant-api.hf.space
10
+ ```
11
+
12
+ ### Alternative URL (if hyphens don't work):
13
+ ```
14
+ https://jatinautonomouslabs-research_ai_assistant_api.hf.space
15
+ ```
16
+
17
+ ## How to Find Your Exact URL
18
+
19
+ 1. **Visit your Space page:**
20
+ - Go to: https://huggingface.co/spaces/JatinAutonomousLabs/Research_AI_Assistant_API
21
+
22
+ 2. **Check the Space Settings:**
23
+ - Look for "Public URL" or "Space URL" in the settings
24
+ - The URL format is typically: `{username}-{spacename}.hf.space`
25
+ - Spaces convert underscores to hyphens in the URL
26
+
27
+ 3. **Test both formats:**
28
+ ```bash
29
+ # Try with hyphens (most common)
30
+ curl https://jatinautonomouslabs-research-ai-assistant-api.hf.space/
31
+
32
+ # Try with underscores (if hyphens don't work)
33
+ curl https://jatinautonomouslabs-research_ai_assistant_api.hf.space/
34
+ ```
35
+
36
+ ## URL Format Rules
37
+
38
+ - **Username:** `JatinAutonomousLabs` → `jatinautonomouslabs` (lowercase)
39
+ - **Space Name:** `Research_AI_Assistant_API` → `research-ai-assistant-api` (lowercase, underscores → hyphens)
40
+ - **Domain:** `.hf.space`
41
+
42
+ ## Quick Test Script
43
+
44
+ ```python
45
+ import requests
46
+
47
+ # Try both URL formats
48
+ urls = [
49
+ "https://jatinautonomouslabs-research-ai-assistant-api.hf.space",
50
+ "https://jatinautonomouslabs-research_ai_assistant_api.hf.space"
51
+ ]
52
+
53
+ for url in urls:
54
+ try:
55
+ response = requests.get(f"{url}/", timeout=5)
56
+ if response.status_code == 200:
57
+ print(f"✅ Working URL: {url}")
58
+ print(f"Response: {response.json()}")
59
+ break
60
+ else:
61
+ print(f"❌ {url} returned {response.status_code}")
62
+ except Exception as e:
63
+ print(f"❌ {url} failed: {e}")
64
+ ```
65
+
66
+ ## Common Issues
67
+
68
+ 1. **404 Error:**
69
+ - Space might still be building (check Space page)
70
+ - URL format might be wrong (try both formats)
71
+ - Space might not be public
72
+
73
+ 2. **503 Error:**
74
+ - Space is running but API is initializing
75
+ - Wait 30-60 seconds and retry
76
+
77
+ 3. **CORS Errors:**
78
+ - API has CORS enabled, but verify the URL is correct
79
+
80
+ ## Verification Steps
81
+
82
+ 1. ✅ Check Space is built and running
83
+ 2. ✅ Verify Space is public
84
+ 3. ✅ Test root endpoint first: `GET /`
85
+ 4. ✅ Test health endpoint: `GET /api/health`
86
+ 5. ✅ Use the working URL in your application
87
+