Skip to content
8 changes: 8 additions & 0 deletions demo_gradio.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,14 @@ def get_gradio_user(request: Request):
app = gr.mount_gradio_app(app, demo_share, path="/discussion")


class HealthCheckFilter(logging.Filter):
"""Remove /health and /health/* from application server logs"""
def filter(self, record: logging.LogRecord) -> bool:
return record.getMessage().find("/health") == -1

logging.getLogger("uvicorn.access").addFilter(HealthCheckFilter())


if __name__ == "__main__":
logger.info("Demo is running on http://localhost:8000")
uvicorn.run(
Expand Down