Pujan Neupane commited on
Commit ·
7dbfd9c
1
Parent(s): e9f0d54
remove hugging face
Browse files- HuggingFace/main.py +0 -18
- HuggingFace/readme.md +0 -61
HuggingFace/main.py
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
from huggingface_hub import Repository
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
def download_repo():
|
| 6 |
-
hf_token = os.getenv("HF_TOKEN")
|
| 7 |
-
if not hf_token:
|
| 8 |
-
raise ValueError("HF_TOKEN not found in environment variables.")
|
| 9 |
-
|
| 10 |
-
repo_id = "Pujan-Dev/test"
|
| 11 |
-
local_dir = "../Ai-Text-Detector/"
|
| 12 |
-
|
| 13 |
-
repo = Repository(local_dir, clone_from=repo_id, token=hf_token)
|
| 14 |
-
print(f"Repository downloaded to: {local_dir}")
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
if __name__ == "__main__":
|
| 18 |
-
download_repo()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HuggingFace/readme.md
DELETED
|
@@ -1,61 +0,0 @@
|
|
| 1 |
-
### Hugging Face CLI Tool
|
| 2 |
-
|
| 3 |
-
This CLI tool allows you to **upload** and **download** models from Hugging Face repositories. It requires an **Hugging Face Access Token (`HF_TOKEN`)** for authentication, especially for private repositories.
|
| 4 |
-
|
| 5 |
-
### Prerequisites
|
| 6 |
-
|
| 7 |
-
1. **Install Hugging Face Hub**:
|
| 8 |
-
|
| 9 |
-
```bash
|
| 10 |
-
pip install huggingface_hub
|
| 11 |
-
```
|
| 12 |
-
|
| 13 |
-
2. **Get HF_TOKEN**:
|
| 14 |
-
- Log in to [Hugging Face](https://huggingface.co/).
|
| 15 |
-
- Go to **Settings** → **Access Tokens** → **Create a new token** with `read` and `write` permissions.
|
| 16 |
-
- Save the token.
|
| 17 |
-
|
| 18 |
-
### Usage
|
| 19 |
-
|
| 20 |
-
1. **Set the Token**:
|
| 21 |
-
|
| 22 |
-
- **Linux/macOS**:
|
| 23 |
-
```bash
|
| 24 |
-
export HF_TOKEN=your_token_here
|
| 25 |
-
```
|
| 26 |
-
- **Windows (CMD)**:
|
| 27 |
-
```bash
|
| 28 |
-
set HF_TOKEN=your_token_here
|
| 29 |
-
```
|
| 30 |
-
|
| 31 |
-
2. **Download Model**:
|
| 32 |
-
|
| 33 |
-
```bash
|
| 34 |
-
python main.py --download --repo-id <repo_name> --save-dir <local_save_path>
|
| 35 |
-
```
|
| 36 |
-
|
| 37 |
-
3. **Upload Model**:
|
| 38 |
-
```bash
|
| 39 |
-
python main.py --upload --repo-id <repo_name> --model-path <local_model_path>
|
| 40 |
-
```
|
| 41 |
-
|
| 42 |
-
### Example
|
| 43 |
-
|
| 44 |
-
To download a model:
|
| 45 |
-
|
| 46 |
-
```bash
|
| 47 |
-
python main.py
|
| 48 |
-
```
|
| 49 |
-
|
| 50 |
-
### Authentication
|
| 51 |
-
|
| 52 |
-
Ensure you set `HF_TOKEN` to access private repositories. If not set, the script will raise an error.
|
| 53 |
-
Here’s a clearer and more polished version of that note:
|
| 54 |
-
|
| 55 |
-
---
|
| 56 |
-
|
| 57 |
-
### ⚠️ Note
|
| 58 |
-
|
| 59 |
-
**Make sure to run this script from the `HuggingFace` directory to ensure correct path resolution and functionality.**
|
| 60 |
-
|
| 61 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|