Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -223,6 +223,7 @@ def create_app():
|
|
| 223 |
# Wrap in try-except to ensure demo is always defined
|
| 224 |
try:
|
| 225 |
demo = create_app()
|
|
|
|
| 226 |
except Exception as e:
|
| 227 |
print(f"β Fatal error creating app: {e}")
|
| 228 |
import traceback
|
|
@@ -266,18 +267,25 @@ if __name__ == "__main__":
|
|
| 266 |
auth_password = os.getenv("APP_PASSWORD")
|
| 267 |
|
| 268 |
# If a username and password are set, authentication will be enabled
|
| 269 |
-
|
| 270 |
if auth_username and auth_password:
|
| 271 |
-
|
| 272 |
-
print("π Authentication enabled")
|
| 273 |
else:
|
| 274 |
-
print("β οΈ No authentication configured")
|
| 275 |
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 283 |
|
|
|
|
| 223 |
# Wrap in try-except to ensure demo is always defined
|
| 224 |
try:
|
| 225 |
demo = create_app()
|
| 226 |
+
print("β
App created successfully!")
|
| 227 |
except Exception as e:
|
| 228 |
print(f"β Fatal error creating app: {e}")
|
| 229 |
import traceback
|
|
|
|
| 267 |
auth_password = os.getenv("APP_PASSWORD")
|
| 268 |
|
| 269 |
# If a username and password are set, authentication will be enabled
|
| 270 |
+
auth_config = None
|
| 271 |
if auth_username and auth_password:
|
| 272 |
+
auth_config = (auth_username, auth_password)
|
| 273 |
+
print(f"π Authentication enabled for user: {auth_username}")
|
| 274 |
else:
|
| 275 |
+
print("β οΈ No authentication configured. App is publicly accessible.")
|
| 276 |
|
| 277 |
+
print("π Launching Gradio app...")
|
| 278 |
+
|
| 279 |
+
try:
|
| 280 |
+
demo.launch(
|
| 281 |
+
share=False,
|
| 282 |
+
server_name="0.0.0.0",
|
| 283 |
+
server_port=7860,
|
| 284 |
+
auth=auth_config
|
| 285 |
+
)
|
| 286 |
+
print("β
App launched successfully!")
|
| 287 |
+
except Exception as e:
|
| 288 |
+
print(f"β Error launching app: {e}")
|
| 289 |
+
import traceback
|
| 290 |
+
traceback.print_exc()
|
| 291 |
|