Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -226,22 +226,15 @@ def create_app():
|
|
| 226 |
demo = interface_builder.create_interface()
|
| 227 |
|
| 228 |
# Set authentication for Hugging Face Spaces
|
| 229 |
-
# In Gradio 6.0
|
|
|
|
| 230 |
if auth_username and auth_password:
|
| 231 |
auth_config = (auth_username, auth_password)
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
else:
|
| 238 |
-
# Method 2: Store auth config for Spaces to use
|
| 239 |
-
demo._auth = auth_config
|
| 240 |
-
print("✅ Authentication configured (stored for launch)")
|
| 241 |
-
except Exception as e:
|
| 242 |
-
print(f"⚠️ Error setting auth: {e}")
|
| 243 |
-
# Fallback: store in custom attribute
|
| 244 |
-
demo._auth_config = auth_config
|
| 245 |
|
| 246 |
return demo
|
| 247 |
|
|
|
|
| 226 |
demo = interface_builder.create_interface()
|
| 227 |
|
| 228 |
# Set authentication for Hugging Face Spaces
|
| 229 |
+
# Note: In Gradio 6.0 on Spaces, auth should be set via launch() parameters
|
| 230 |
+
# Since Spaces auto-launches, we'll store auth config for potential use
|
| 231 |
if auth_username and auth_password:
|
| 232 |
auth_config = (auth_username, auth_password)
|
| 233 |
+
# Store auth config - Spaces may use this when auto-launching
|
| 234 |
+
# For Gradio 6.0, we can't directly set demo.auth before launch
|
| 235 |
+
# Spaces will handle authentication if configured properly
|
| 236 |
+
demo._hf_auth = auth_config
|
| 237 |
+
print("✅ Authentication credentials stored (Spaces will handle on launch)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
|
| 239 |
return demo
|
| 240 |
|