James Frecheville commited on
Commit
e879951
·
1 Parent(s): 4a13ccd

Fix Gradio UI components and update Dockerfile with proper system dependencies

Browse files
Files changed (2) hide show
  1. Dockerfile +12 -3
  2. owl/webapp.py +1 -1
Dockerfile CHANGED
@@ -21,6 +21,7 @@ RUN apt-get update && apt-get install -y \
21
  libsm6 \
22
  libxext6 \
23
  ffmpeg \
 
24
  && rm -rf /var/lib/apt/lists/*
25
 
26
  # Set working directory
@@ -30,7 +31,7 @@ WORKDIR /app
30
  COPY requirements.txt .
31
  RUN pip install --no-cache-dir -r requirements.txt
32
 
33
- # Install Playwright browsers
34
  RUN playwright install chromium
35
  RUN playwright install-deps
36
 
@@ -43,9 +44,17 @@ ENV GRADIO_SERVER_PORT=7861
43
  ENV GRADIO_ANALYTICS_ENABLED=false
44
  ENV GRADIO_ALLOW_FLAGGING=false
45
  ENV GRADIO_QUEUE_ENABLED=false
 
 
 
 
 
 
 
 
46
 
47
  # Expose the port
48
  EXPOSE 7861
49
 
50
- # Run the application
51
- CMD ["python", "app.py"]
 
21
  libsm6 \
22
  libxext6 \
23
  ffmpeg \
24
+ xvfb \
25
  && rm -rf /var/lib/apt/lists/*
26
 
27
  # Set working directory
 
31
  COPY requirements.txt .
32
  RUN pip install --no-cache-dir -r requirements.txt
33
 
34
+ # Install Playwright browsers and dependencies
35
  RUN playwright install chromium
36
  RUN playwright install-deps
37
 
 
44
  ENV GRADIO_ANALYTICS_ENABLED=false
45
  ENV GRADIO_ALLOW_FLAGGING=false
46
  ENV GRADIO_QUEUE_ENABLED=false
47
+ ENV DISPLAY=:99
48
+
49
+ # Create a non-root user
50
+ RUN useradd -m -u 1000 user && \
51
+ chown -R user:user /app
52
+
53
+ # Switch to non-root user
54
+ USER user
55
 
56
  # Expose the port
57
  EXPOSE 7861
58
 
59
+ # Run the application with Xvfb
60
+ CMD Xvfb :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & python app.py
owl/webapp.py CHANGED
@@ -1145,7 +1145,7 @@ def create_ui():
1145
  with gr.Tabs(): # Set conversation record as the default selected tab
1146
  with gr.TabItem("Conversation Record"):
1147
  # Add conversation record display area
1148
- with gr.Box():
1149
  log_display2 = gr.Markdown(
1150
  value="No conversation records yet.",
1151
  elem_classes="log-display",
 
1145
  with gr.Tabs(): # Set conversation record as the default selected tab
1146
  with gr.TabItem("Conversation Record"):
1147
  # Add conversation record display area
1148
+ with gr.Column():
1149
  log_display2 = gr.Markdown(
1150
  value="No conversation records yet.",
1151
  elem_classes="log-display",