Bryceeee commited on
Commit
25bb1fc
·
verified ·
1 Parent(s): 4082491

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -12
app.py CHANGED
@@ -222,27 +222,22 @@ def create_app():
222
  proactive_engine=components["proactive_engine"]
223
  )
224
 
225
- # Create interface with authentication
226
- auth_config = None
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 use demo.auth or configure it during launch
234
- # Since Spaces auto-launches, we set it here so Spaces can use it
235
- if auth_config:
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: Use launch configuration
243
- # Store auth config to be used when Spaces launches
244
  demo._auth = auth_config
245
- print("✅ Authentication configured (will be applied on launch)")
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