zyliu commited on
Commit
0a9a2be
1 Parent(s): a59589f

update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -333,6 +333,8 @@ def http_bot(
333
  controller_url + "/get_worker_address", json={"model": model_name}
334
  )
335
  worker_addr = ret.json()["address"]
 
 
336
  logger.info(f"model_name: {model_name}, worker_addr: {worker_addr}")
337
 
338
  # No available worker
@@ -825,6 +827,7 @@ if __name__ == "__main__":
825
  parser.add_argument("--host", type=str, default="0.0.0.0")
826
  parser.add_argument("--port", type=int, default=7860)
827
  parser.add_argument("--controller-url", type=str, default=None)
 
828
  parser.add_argument("--concurrency-count", type=int, default=10)
829
  parser.add_argument(
830
  "--model-list-mode", type=str, default="reload", choices=["once", "reload"]
@@ -841,6 +844,9 @@ if __name__ == "__main__":
841
  if not args.controller_url:
842
  raise ValueError("controller-url is required.")
843
 
 
 
 
844
  models = get_model_list()
845
 
846
  sd_worker_url = args.sd_worker_url
 
333
  controller_url + "/get_worker_address", json={"model": model_name}
334
  )
335
  worker_addr = ret.json()["address"]
336
+ if worker_addr.startswith("http://0.0.0.0"):
337
+ worker_addr = worker_addr.replace("0.0.0.0", args.worker_ip)
338
  logger.info(f"model_name: {model_name}, worker_addr: {worker_addr}")
339
 
340
  # No available worker
 
827
  parser.add_argument("--host", type=str, default="0.0.0.0")
828
  parser.add_argument("--port", type=int, default=7860)
829
  parser.add_argument("--controller-url", type=str, default=None)
830
+ parser.add_argument("--worker-ip", type=str, default=None)
831
  parser.add_argument("--concurrency-count", type=int, default=10)
832
  parser.add_argument(
833
  "--model-list-mode", type=str, default="reload", choices=["once", "reload"]
 
844
  if not args.controller_url:
845
  raise ValueError("controller-url is required.")
846
 
847
+ if not args.worker_ip:
848
+ args.worker_ip = os.environ.get("WORKER_IP", None)
849
+
850
  models = get_model_list()
851
 
852
  sd_worker_url = args.sd_worker_url