Spaces:
Running
Running
Tonic commited on
resolves the urls correctly
Browse filesFiles changed (2)
12345{ "model_name": "HuggingFaceTB/SmolLM3-3B", "batch_size": 8, "learning_rate": 2e-05}53 unmodified lines54555657585960616263646566676869701 unmodified line7273747576777853 unmodified linesdef _resolve_space_url(self) -> Optional[str]:"""Resolve Space URL using Hugging Face Hub API"""try:if not HF_HUB_AVAILABLE:logger.warning("⚠️ Hugging Face Hub not available, using default URL format")# Fallback to default URL formatspace_name = self.space_id.replace('/', '-')return f"https://{space_name}.hf.space"# Use Hugging Face Hub API to get Space infoapi = HfApi(token=self.hf_token)# Get Space infospace_info = api.space_info(self.space_id)if space_info and hasattr(space_info, 'host'):# Use the host directly from space_infospace_url = space_info.host1 unmodified linereturn space_urlelse:# Fallback to default URL formatspace_name = self.space_id.replace('/', '-')space_url = f"https://{space_name}.hf.space"logger.info(f"✅ Using fallback Space URL: {space_url}")return space_url53 unmodified lines545556575859606162636465666768697071727374757677787980818283841 unmodified line8687888990919253 unmodified linesdef _resolve_space_url(self) -> Optional[str]:"""Resolve Space URL using Hugging Face Hub API"""try:# Clean the space_id - remove any URL prefixesclean_space_id = self.space_idif clean_space_id.startswith('http'):# Extract space ID from URLif '/spaces/' in clean_space_id:clean_space_id = clean_space_id.split('/spaces/')[-1]else:# Try to extract from URL formatclean_space_id = clean_space_id.replace('https://', '').replace('http://', '')if '.hf.space' in clean_space_id:clean_space_id = clean_space_id.replace('.hf.space', '').replace('-', '/')logger.info(f"🔧 Resolving Space URL for ID: {clean_space_id}")if not HF_HUB_AVAILABLE:logger.warning("⚠️ Hugging Face Hub not available, using default URL format")# Fallback to default URL formatspace_name = clean_space_id.replace('/', '-')return f"https://{space_name}.hf.space"# Use Hugging Face Hub API to get Space infoapi = HfApi(token=self.hf_token)# Get Space infospace_info = api.space_info(clean_space_id)if space_info and hasattr(space_info, 'host'):# Use the host directly from space_infospace_url = space_info.host1 unmodified linereturn space_urlelse:# Fallback to default URL formatspace_name = clean_space_id.replace('/', '-')space_url = f"https://{space_name}.hf.space"logger.info(f"✅ Using fallback Space URL: {space_url}")return space_url
config_test_monitoring_auto_resolve_20250727_161709.jsonAdded+5
scripts/trackio_tonic/trackio_api_client.py+17-3