Spaces:
Running
Running
trevorpfiz
commited on
Commit
·
8f90477
1
Parent(s):
275afd3
user permissions
Browse files- Dockerfile +7 -2
- src/vlm_playground/app.py +23 -0
Dockerfile
CHANGED
@@ -7,17 +7,22 @@ ARG USER_GID=1000
|
|
7 |
RUN groupadd --gid ${USER_GID} ${USERNAME} \
|
8 |
&& useradd --uid ${USER_UID} --gid ${USER_GID} --create-home ${USERNAME}
|
9 |
|
|
|
|
|
|
|
|
|
10 |
ENV HOME=/home/${USERNAME}
|
|
|
|
|
11 |
WORKDIR ${HOME}/app
|
12 |
|
13 |
# Enable bytecode compilation and copy mode for mounted volumes
|
14 |
ENV UV_COMPILE_BYTECODE=1
|
15 |
ENV UV_LINK_MODE=copy
|
16 |
|
17 |
-
USER ${USERNAME}
|
18 |
-
|
19 |
# Writable UV cache for non-root user
|
20 |
ENV UV_CACHE_DIR=${HOME}/.cache/uv
|
|
|
21 |
|
22 |
# Install dependencies from lockfile using bind mounts (no cache mount to avoid perms issues)
|
23 |
RUN --mount=type=bind,source=uv.lock,target=uv.lock,readonly \
|
|
|
7 |
RUN groupadd --gid ${USER_GID} ${USERNAME} \
|
8 |
&& useradd --uid ${USER_UID} --gid ${USER_GID} --create-home ${USERNAME}
|
9 |
|
10 |
+
# Switch to the "user" user
|
11 |
+
USER ${USERNAME}
|
12 |
+
|
13 |
+
# Set home to the user's home directory
|
14 |
ENV HOME=/home/${USERNAME}
|
15 |
+
|
16 |
+
# Set the working directory to the user's home directory
|
17 |
WORKDIR ${HOME}/app
|
18 |
|
19 |
# Enable bytecode compilation and copy mode for mounted volumes
|
20 |
ENV UV_COMPILE_BYTECODE=1
|
21 |
ENV UV_LINK_MODE=copy
|
22 |
|
|
|
|
|
23 |
# Writable UV cache for non-root user
|
24 |
ENV UV_CACHE_DIR=${HOME}/.cache/uv
|
25 |
+
RUN mkdir -p ${UV_CACHE_DIR}
|
26 |
|
27 |
# Install dependencies from lockfile using bind mounts (no cache mount to avoid perms issues)
|
28 |
RUN --mount=type=bind,source=uv.lock,target=uv.lock,readonly \
|
src/vlm_playground/app.py
CHANGED
@@ -1,6 +1,29 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
def greet(name: str) -> str:
|
5 |
return f"Hello {name}!!"
|
6 |
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
|
4 |
+
def greet(name: str) -> str:
|
5 |
+
return f"Hello {name}!!"
|
6 |
+
|
7 |
+
|
8 |
+
demo = gr.Interface(
|
9 |
+
fn=greet,
|
10 |
+
inputs="text",
|
11 |
+
outputs="text",
|
12 |
+
title="VLM Playground Gradio Demo",
|
13 |
+
description="Simple demo app to verify Gradio + uv Docker setup.",
|
14 |
+
)
|
15 |
+
|
16 |
+
|
17 |
+
def main() -> None:
|
18 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|
19 |
+
|
20 |
+
|
21 |
+
if __name__ == "__main__":
|
22 |
+
main()
|
23 |
+
|
24 |
+
import gradio as gr
|
25 |
+
|
26 |
+
|
27 |
def greet(name: str) -> str:
|
28 |
return f"Hello {name}!!"
|
29 |
|