Secure Your Code on Hugging Face Spaces

Encrypt and protect your proprietary machine learning applications

Get Started View Source

Why HFCrypt?

HFCrypt enables developers to protect their proprietary code while still leveraging the powerful infrastructure of Hugging Face Spaces.

🔒

Protect Your IP

Keep your proprietary algorithms, custom implementations, and competitive advantages secure from public view.

âš¡

Simple Integration

Compress, encrypt, and deploy your application with a single command, making security effortless.

🚀

Full GPU Support

Maintain all the performance benefits of Hugging Face Spaces, including GPU acceleration for your encrypted apps. ZeroGPU support coming soon.

The Challenge

Hugging Face Spaces is an incredible platform for hosting machine learning demos, but by default, all code is publicly visible. This presents challenges for:

Our Solution

HFCrypt provides a secure and elegant solution by utilizing Hugging Face's own "Secrets" feature in an innovative way:

  1. Your entire application is compressed into a single package
  2. Strong encryption is applied with a unique generated key
  3. The key is stored securely in Hugging Face Spaces Secrets
  4. A lightweight loader decrypts your application at runtime
  5. Your code runs normally, with all functionality preserved

Get Started in Minutes

Follow these simple steps to secure your Hugging Face Space:

  1. Place your application files in the "app" folder
  2. Name your main file "app.py" and set the host to "0.0.0.0"
  3. Run the command below in your terminal (Unix/Linux)
  4. Deploy the generated code to Hugging Face Spaces

Note: For Windows instructions, please refer to the GitHub repository.

Frequently Asked Questions

Is HFCrypt free and open-source?

Yes, HFCrypt is completely free and open-source. The entire codebase can be reviewed on GitHub.

How secure is the encryption?

HFCrypt uses the industry-standard Fernet encryption library maintained by the Python Cryptographic Authority. While no encryption is 100% unbreakable, this provides strong protection for most use cases. For highly sensitive or mission-critical applications, we recommend additional security measures.

When should I consider encrypting my code?

While we encourage open-source development whenever possible, encryption makes sense when you have proprietary algorithms, embed sensitive API keys, or use components with restrictive licensing that prohibits redistribution.

Does GPU acceleration still work with encrypted apps?

Yes, HFCrypt maintains full compatibility with Hugging Face Spaces GPU acceleration. Your encrypted applications will run with the same performance as unencrypted ones. ZeroGPU is currently unsupported but will be added soon.

Will HFCrypt access my code?

No. All compression and encryption happens locally on your machine. Your code is never transmitted to our servers or any third party (except Hugging Face).

Who created HFCrypt?

HFCrypt was created by mrfakename. It is an independent project with no affiliation to Hugging Face.