Spaces:
Running
Running
Commit
Β·
8d3b423
1
Parent(s):
bfd172f
Upload 5 files
Browse files- Dockerfile +7 -0
- README.md +34 -7
- app.hfc +1 -0
- decrypt.py +19 -0
- hfcryptdecrypt.sh +3 -0
Dockerfile
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
RUN useradd -m -u 1000 user
|
3 |
+
USER user
|
4 |
+
WORKDIR /app
|
5 |
+
COPY . /app
|
6 |
+
EXPOSE 7860
|
7 |
+
CMD ["sh", "hfcryptdecrypt.sh"]
|
README.md
CHANGED
@@ -1,10 +1,37 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
8 |
---
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
title: __TITLE__
|
3 |
+
emoji: π
|
4 |
+
sdk: gradio
|
5 |
+
license: other
|
6 |
+
license_name: hfcrypt
|
7 |
+
license_link: https://github.com/hfcrypt/hfcrypt
|
8 |
+
library_name: hfcrypt
|
9 |
---
|
10 |
|
11 |
+
# HFCrypt Encrypted Space
|
12 |
+
|
13 |
+
This space is encrypted by [HFCrypt](https://github.com/hfcrypt/hfcrypt), allowing you to run closed-source code on Hugging Face spaces! Protect your API keys, source code, and more using advanced encryption! Learn more and encrypt your own app by checking out the open-sourced [HFCrypt](https://github.com/hfcrypt/hfcrypt)!
|
14 |
+
|
15 |
+
## [Visit HFCrypt](https://github.com/hfcrypt/hfcrypt)
|
16 |
+
|
17 |
+
## License
|
18 |
+
|
19 |
+
Unless otherwise noted, the encrypted source is licensed under the [HFCrypt Encrypted Space License](https://github.com/hfcrypt/hfcrypt), available in the `HESC.md` file in the HFCrypt repository.---
|
20 |
+
title: HFCrypt Demo
|
21 |
+
emoji: π
|
22 |
+
sdk: gradio
|
23 |
+
license: other
|
24 |
+
license_name: hfcrypt
|
25 |
+
license_link: https://github.com/hfcrypt/hfcrypt
|
26 |
+
library_name: hfcrypt
|
27 |
+
---
|
28 |
+
|
29 |
+
# HFCrypt Encrypted Space
|
30 |
+
|
31 |
+
This space is encrypted by [HFCrypt](https://github.com/hfcrypt/hfcrypt), allowing you to run closed-source code on Hugging Face spaces! Protect your API keys, source code, and more using advanced encryption! Learn more and encrypt your own app by checking out the open-sourced [HFCrypt](https://github.com/hfcrypt/hfcrypt)!
|
32 |
+
|
33 |
+
## [Visit HFCrypt](https://github.com/hfcrypt/hfcrypt)
|
34 |
+
|
35 |
+
## License
|
36 |
+
|
37 |
+
Unless otherwise noted, the encrypted source is licensed under the [HFCrypt Encrypted Space License](https://github.com/hfcrypt/hfcrypt), available in the `HESC.md` file in the HFCrypt repository.
|
app.hfc
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
gAAAAABlIdaYJKCCBS4p1bX83VVnRjrP9hL-P8zaCNLm5o_MDyqYjqKhSmXpdZHNmGdl7vBJF71YjJP4pwJXXpNatfD74-gcLlojcVm9aMZXfSm3B6nZ4_BR1zRy39NM4K9zriufbhy3u8LUZrxON8aTQDosx9zeb3rKARyYwUpbyMLP-aYLz3c2p_3Vznv3Cc-evbuZa5L0GHaGS7BbVCFIqNJHf8TDFUUfEKJUuuGkU2-QgUcXc55RYBT1NH908nJ8o-2z6r-bzUvZrpGMESV4yEJUr2P1jdB3j1umeYwXcSNOdFyW9CTieuXxWfjlsWn73BPIg3bbUoQhoAeXlYFnjS2Jti61HrHP5g7aD_i5ZPFXUnHHE4yxM6bn4bxR6hUXHtOw0ALeaXHWWyh33RE5AZkebBioQhbHFJiAj3IlHASL5ZfI6oXqTxwwsWzVZDoNmmg11LMbSjByQZLOy1jxOE7CcYCBIorimLxW4XLJF01azAS5qZKx-H68i_CUREIWgBq71yaCKJpfcGarVnKrdkJsZ8He4ohucaRIi0oO8Cfk3VDSTx0=
|
decrypt.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from cryptography.fernet import Fernet
|
2 |
+
import zipfile
|
3 |
+
import os
|
4 |
+
key = os.environ["HFCRYPT_KEY"]
|
5 |
+
encrypted_filename = os.path.abspath(os.path.join(os.path.dirname(__file__), 'app.hfc'))
|
6 |
+
|
7 |
+
with open(encrypted_filename, 'rb') as file:
|
8 |
+
encrypted_data = file.read()
|
9 |
+
|
10 |
+
cipher_suite = Fernet(key)
|
11 |
+
decrypted_data = cipher_suite.decrypt(encrypted_data)
|
12 |
+
|
13 |
+
decrypted_output_filename = os.path.abspath(os.path.join(os.path.dirname(__file__), 'out.zip'))
|
14 |
+
|
15 |
+
with open(decrypted_output_filename, 'wb') as file:
|
16 |
+
file.write(decrypted_data)
|
17 |
+
|
18 |
+
with zipfile.ZipFile(decrypted_output_filename, 'r') as zip_ref:
|
19 |
+
zip_ref.extractall(os.path.abspath(os.path.join(os.path.dirname(__file__), 'hfapp')))
|
hfcryptdecrypt.sh
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
pip3 install cryptography --user && python3 decrypt.py
|
2 |
+
python3 -m pip install --no-cache-dir -r hfapp/requirements.txt --user
|
3 |
+
python3 hfapp/app.py
|