darshanajudiya7 commited on
Commit
63eda9e
·
1 Parent(s): 01960bc

Fix Gradio 6 startup warning and quiet access logs

Browse files
Files changed (4) hide show
  1. Dockerfile +1 -1
  2. server/Dockerfile +1 -1
  3. server/app.py +10 -4
  4. server/demo.py +1 -1
Dockerfile CHANGED
@@ -24,4 +24,4 @@ EXPOSE 8000
24
  HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
25
  CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=3).read()"
26
 
27
- CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8000"]
 
24
  HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
25
  CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=3).read()"
26
 
27
+ CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8000", "--no-access-log"]
server/Dockerfile CHANGED
@@ -24,4 +24,4 @@ EXPOSE 8000
24
  HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
25
  CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=3).read()"
26
 
27
- CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8000"]
 
24
  HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
25
  CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=3).read()"
26
 
27
+ CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8000", "--no-access-log"]
server/app.py CHANGED
@@ -53,10 +53,16 @@ def build_application():
53
  served_app = api_app
54
  if gr is not None and _gradio_enabled():
55
  try:
56
- from .demo import build_demo
57
  except ImportError:
58
- from server.demo import build_demo
59
- served_app = gr.mount_gradio_app(api_app, build_demo(), path="/")
 
 
 
 
 
 
60
 
61
  wrapper_app = FastAPI(title="python_code_review_env", version="1.0.0")
62
 
@@ -74,7 +80,7 @@ app = build_application()
74
  def main(host: str = "0.0.0.0", port: int = 8000) -> None:
75
  import uvicorn
76
 
77
- uvicorn.run(app, host=host, port=port)
78
 
79
 
80
  if __name__ == "__main__":
 
53
  served_app = api_app
54
  if gr is not None and _gradio_enabled():
55
  try:
56
+ from .demo import CSS, build_demo
57
  except ImportError:
58
+ from server.demo import CSS, build_demo
59
+ served_app = gr.mount_gradio_app(
60
+ api_app,
61
+ build_demo(),
62
+ path="/",
63
+ theme=gr.themes.Soft(primary_hue="orange", secondary_hue="amber"),
64
+ css=CSS,
65
+ )
66
 
67
  wrapper_app = FastAPI(title="python_code_review_env", version="1.0.0")
68
 
 
80
  def main(host: str = "0.0.0.0", port: int = 8000) -> None:
81
  import uvicorn
82
 
83
+ uvicorn.run(app, host=host, port=port, access_log=False)
84
 
85
 
86
  if __name__ == "__main__":
server/demo.py CHANGED
@@ -347,7 +347,7 @@ def build_demo() -> gr.Blocks:
347
  examples = get_default_engine().example_map()
348
  first_example = next(iter(examples.values()))
349
 
350
- with gr.Blocks(theme=gr.themes.Soft(primary_hue="orange", secondary_hue="amber"), css=CSS, title="TorchReview Copilot") as demo:
351
  gr.HTML(
352
  """
353
  <div class="hero-card">
 
347
  examples = get_default_engine().example_map()
348
  first_example = next(iter(examples.values()))
349
 
350
+ with gr.Blocks(title="TorchReview Copilot") as demo:
351
  gr.HTML(
352
  """
353
  <div class="hero-card">