Spaces:
Sleeping
Download backend/admin_tools/HTTPS_SETUP.md from jinksQspider/FaceMarkPro2: direct link, hf CLI and curl.
- Browser
- Download file 2.24 kB
-
https://huggingface.co/spaces/jinksQspider/FaceMarkPro2/resolve/main/backend/admin_tools/HTTPS_SETUP.md
- Command line
-
hf download hf://spaces/jinksQspider/FaceMarkPro2/backend/admin_tools/HTTPS_SETUP.md
-
curl -L -o HTTPS_SETUP.md https://huggingface.co/spaces/jinksQspider/FaceMarkPro2/resolve/main/backend/admin_tools/HTTPS_SETUP.md
Enable HTTPS for Camera Access
Problem
Modern browsers require HTTPS (or localhost) to access camera/microphone. When accessing your app from network devices (e.g., http://192.168.1.3:7860), camera access will be blocked.
Quick Solution
Step 1: Install cryptography
pip install cryptography
Step 2: Generate SSL Certificate
python generate_cert.py
This creates:
cert.pem- SSL certificatekey.pem- Private key
Step 3: Enable HTTPS in .env
Add or update your .env file:
USE_HTTPS=true
Step 4: Restart the App
python run.py
Step 5: Access via HTTPS
Open your browser and go to:
https://localhost:7860(on same machine)https://192.168.1.3:7860(from other devices, replace with your IP)
Step 6: Accept Security Warning
Since this is a self-signed certificate, your browser will show a warning:
- Click "Advanced" or "Show Details"
- Click "Proceed to localhost (unsafe)" or "Accept the Risk and Continue"
- This is safe for local development
Alternative: Use Localhost Only
If you're testing on the same machine, simply access via:
http://localhost:7860
No HTTPS needed! Camera will work on localhost even with HTTP.
For Production (Hugging Face Spaces)
No configuration needed! Hugging Face provides HTTPS automatically.
Troubleshooting
"Camera access is not supported"
- Make sure you're using HTTPS or localhost
- Use a modern browser (Chrome, Firefox, Edge)
- Avoid using Internet Explorer
"Permission denied"
- Click the camera icon in the browser address bar
- Select "Allow" for camera access
- Refresh the page
"No camera found"
- Check if your camera is connected
- Close other apps that might be using the camera (Zoom, Teams, etc.)
- Try a different browser
Certificate errors
If you see certificate errors after regenerating:
- Clear browser cache/cookies for localhost
- Close all browser windows
- Restart the browser
- Try again
Security Notes
⚠ The generated certificate is self-signed and only for local development ⚠ Never use self-signed certificates in production ✓ For production, use proper SSL certificates (Let's Encrypt, etc.)