Spaces:
Running
on
Zero
Running
on
Zero
A newer version of the Gradio SDK is available:
6.2.0
Password Protection Setup (No HF Account Required)
β Solution: Gradio Built-in Authentication
Good news: You don't need to build your own frontend! Gradio has built-in password protection that works without Hugging Face accounts.
How It Works
- Users visit your Space URL
- They see a login screen (username/password)
- No Hugging Face account needed!
- Simple and secure
Setup Steps
Step 1: Update app.py
The code is already updated! Just change the password:
demo.launch(
auth=("starflow", "your-password-here"), # Change this!
share=False
)
Step 2: Set Your Password
- Edit app.py in your Space (or locally and push)
- Change:
"your-password-here"to your actual password - Save and push
Step 3: Share Access
Option A: Single Username/Password
auth=("starflow", "my-secure-password")
- Everyone uses same login
- Simple to share
Option B: Multiple Users
auth=[
("user1", "password1"),
("user2", "password2"),
("user3", "password3")
]
- Different login for each person
- More control
Usage
Make Space Public (so anyone can access the URL)
- Settings β Visibility β Public
- Or keep Private (only collaborators see it)
Share the Space URL:
Users visit URL:
- See login screen
- Enter username/password
- No HF account needed!
- Access granted β
Security Tips
- β Use strong passwords
- β Change password regularly
- β Don't share password publicly
- β Use different passwords for different users (if using multiple)
Alternative: Environment Variables (More Secure)
For better security, use environment variables:
import os
username = os.getenv("STARFLOW_USERNAME", "starflow")
password = os.getenv("STARFLOW_PASSWORD", "default-password")
demo.launch(auth=(username, password))
Then set in Space Settings β Variables:
STARFLOW_USERNAME= your-usernameSTARFLOW_PASSWORD= your-password
Benefits
β No HF account needed - Users just need password β Simple - Built into Gradio β Secure - Password protected β Easy to manage - Change password anytime β No custom frontend - Uses existing Gradio UI
Summary
You DON'T need to build your own frontend!
Just:
- Add password to app.py
- Make Space Public (or keep Private + share URL)
- Share URL + password with users
- Done! β