Spaces:
Running
Running
Update scripts/download_model.py
Browse files
scripts/download_model.py
CHANGED
|
@@ -44,12 +44,15 @@ def download_efficientnet_model():
|
|
| 44 |
local_dir=str(models_dir),
|
| 45 |
local_dir_use_symlinks=False
|
| 46 |
)
|
| 47 |
-
#
|
| 48 |
-
|
|
|
|
| 49 |
import shutil
|
| 50 |
-
|
|
|
|
|
|
|
| 51 |
size_mb = model_path.stat().st_size / (1024 * 1024)
|
| 52 |
-
logger.info(f"Model downloaded from HF Hub successfully ({size_mb:.1f}MB)")
|
| 53 |
return True
|
| 54 |
except ImportError:
|
| 55 |
logger.warning("huggingface_hub not installed. Install with: pip install huggingface_hub")
|
|
|
|
| 44 |
local_dir=str(models_dir),
|
| 45 |
local_dir_use_symlinks=False
|
| 46 |
)
|
| 47 |
+
# Copy to expected location if needed (HF Hub creates nested structure)
|
| 48 |
+
downloaded_path = Path(downloaded_path)
|
| 49 |
+
if downloaded_path != model_path:
|
| 50 |
import shutil
|
| 51 |
+
logger.info(f"Copying model from {downloaded_path} to {model_path}")
|
| 52 |
+
shutil.copy2(downloaded_path, model_path)
|
| 53 |
+
logger.info(f"Model copied to expected location: {model_path}")
|
| 54 |
size_mb = model_path.stat().st_size / (1024 * 1024)
|
| 55 |
+
logger.info(f"Model downloaded from HF Hub successfully ({size_mb:.1f}MB) at {model_path}")
|
| 56 |
return True
|
| 57 |
except ImportError:
|
| 58 |
logger.warning("huggingface_hub not installed. Install with: pip install huggingface_hub")
|