Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -222,27 +222,22 @@ def create_app():
|
|
| 222 |
proactive_engine=components["proactive_engine"]
|
| 223 |
)
|
| 224 |
|
| 225 |
-
# Create interface
|
| 226 |
-
|
| 227 |
-
if auth_username and auth_password:
|
| 228 |
-
auth_config = (auth_username, auth_password)
|
| 229 |
-
|
| 230 |
-
demo = interface_builder.create_interface(auth=auth_config)
|
| 231 |
|
| 232 |
# Set authentication for Hugging Face Spaces
|
| 233 |
-
# In Gradio 6.0+, we can
|
| 234 |
-
|
| 235 |
-
|
| 236 |
try:
|
| 237 |
# Method 1: Try setting auth attribute directly (Gradio 6.0+)
|
| 238 |
if hasattr(demo, 'auth'):
|
| 239 |
demo.auth = auth_config
|
| 240 |
print("✅ Authentication configured via demo.auth")
|
| 241 |
else:
|
| 242 |
-
# Method 2:
|
| 243 |
-
# Store auth config to be used when Spaces launches
|
| 244 |
demo._auth = auth_config
|
| 245 |
-
print("✅ Authentication configured (
|
| 246 |
except Exception as e:
|
| 247 |
print(f"⚠️ Error setting auth: {e}")
|
| 248 |
# Fallback: store in custom attribute
|
|
|
|
| 222 |
proactive_engine=components["proactive_engine"]
|
| 223 |
)
|
| 224 |
|
| 225 |
+
# Create interface (without auth parameter to avoid compatibility issues)
|
| 226 |
+
demo = interface_builder.create_interface()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
|
| 228 |
# Set authentication for Hugging Face Spaces
|
| 229 |
+
# In Gradio 6.0+, we can set auth after creating the demo
|
| 230 |
+
if auth_username and auth_password:
|
| 231 |
+
auth_config = (auth_username, auth_password)
|
| 232 |
try:
|
| 233 |
# Method 1: Try setting auth attribute directly (Gradio 6.0+)
|
| 234 |
if hasattr(demo, 'auth'):
|
| 235 |
demo.auth = auth_config
|
| 236 |
print("✅ Authentication configured via demo.auth")
|
| 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
|