alessandro trinca tornidor commited on
Commit
8f9c746
1 Parent(s): d1a9650

ci: fix host gradio listening host value

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -23,7 +23,8 @@ LOG_JSON_FORMAT = bool(os.getenv("LOG_JSON_FORMAT", False))
23
  LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO")
24
  setup_logging(json_logs=LOG_JSON_FORMAT, log_level=LOG_LEVEL)
25
  logger = structlog.stdlib.get_logger(__name__)
26
- app = FastAPI(title="Example API", version="1.0.0")
 
27
 
28
 
29
  @app.middleware("http")
@@ -110,7 +111,9 @@ logger.info("gradio app mounted")
110
 
111
  if __name__ == "__main__":
112
  try:
113
- uvicorn.run("app:app", host="127.0.0.1", port=7860, log_config=None, reload=True)
114
  except Exception as ex:
115
- logging.error(f"ex:{ex}.")
 
116
  raise ex
 
 
23
  LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO")
24
  setup_logging(json_logs=LOG_JSON_FORMAT, log_level=LOG_LEVEL)
25
  logger = structlog.stdlib.get_logger(__name__)
26
+ title = "Example API"
27
+ app = FastAPI(title=title, version="1.0.0")
28
 
29
 
30
  @app.middleware("http")
 
111
 
112
  if __name__ == "__main__":
113
  try:
114
+ uvicorn.run(host="0.0.0.0", port=7860, app=app)
115
  except Exception as ex:
116
+ logger.error(f"fastapi/gradio application {title}, exception:{ex}.")
117
+ print(f"fastapi/gradio application {title}, exception:{ex}.")
118
  raise ex
119
+