David Pomerenke commited on
Commit
f9431d1
·
1 Parent(s): 68e918f

Add GH action for pushing to HF

Browse files
.github/workflows/huggingface-upload.yml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Upload to Hugging Face
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, master ]
6
+
7
+ jobs:
8
+ upload:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v3
12
+
13
+ - name: Set up Python
14
+ uses: actions/setup-python@v4
15
+ with:
16
+ python-version: '3.9'
17
+
18
+ - name: Install dependencies
19
+ run: |
20
+ python -m pip install --upgrade pip
21
+ pip install huggingface_hub python-dotenv
22
+
23
+ - name: Upload to Hugging Face
24
+ env:
25
+ HUGGINGFACE_ACCESS_TOKEN: ${{ secrets.HUGGINGFACE_ACCESS_TOKEN }}
26
+ run: |
27
+ python -c '
28
+ from huggingface_hub import upload_folder
29
+ import os
30
+
31
+ upload_folder(
32
+ folder_path=".",
33
+ path_in_repo="/",
34
+ repo_id="datenlabor-bmz/ai-language-monitor",
35
+ repo_type="space",
36
+ token=os.environ["HUGGINGFACE_ACCESS_TOKEN"],
37
+ )
38
+ '
frontend/upload.py DELETED
@@ -1,20 +0,0 @@
1
- # /// script
2
- # dependencies = [
3
- # "huggingface_hub",
4
- # "python-dotenv",
5
- # ]
6
- # ///
7
-
8
- from huggingface_hub import upload_folder
9
- import os
10
- from dotenv import load_dotenv
11
-
12
- load_dotenv()
13
-
14
- upload_folder(
15
- folder_path="build",
16
- path_in_repo="/",
17
- repo_id="datenlabor-bmz/ai-language-monitor",
18
- repo_type="space",
19
- token=os.getenv("HUGGINGFACE_ACCESS_TOKEN"),
20
- )