GoodLuckChuck commited on
Commit
998fa3d
·
verified ·
1 Parent(s): 8107e39

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -1111,11 +1111,15 @@ if __name__ == "__main__":
1111
  log_config = uvicorn.config.LOGGING_CONFIG
1112
  log_config["formatters"]["access"]["fmt"] = "%(asctime)s - %(levelname)s - %(message)s"
1113
 
 
 
 
1114
  # Run the server with explicit host and port
1115
  uvicorn.run(
1116
- app,
1117
- host="0.0.0.0",
1118
- port=7860,
1119
  log_config=log_config,
1120
- log_level="info"
 
1121
  )
 
1111
  log_config = uvicorn.config.LOGGING_CONFIG
1112
  log_config["formatters"]["access"]["fmt"] = "%(asctime)s - %(levelname)s - %(message)s"
1113
 
1114
+ # Get port from environment variable or default to 7860 (standard HF Spaces port)
1115
+ port = int(os.environ.get("PORT", 7860))
1116
+
1117
  # Run the server with explicit host and port
1118
  uvicorn.run(
1119
+ "improved_agent:app", # Use string reference instead of app instance
1120
+ host="0.0.0.0", # Required for HF Spaces
1121
+ port=port,
1122
  log_config=log_config,
1123
+ log_level="info",
1124
+ reload=False # Disable reload in production
1125
  )