hysts HF Staff commited on
Commit
fcf9d92
·
1 Parent(s): 23d96d2

Add files

Browse files
Files changed (4) hide show
  1. Dockerfile +32 -0
  2. README.md +4 -1
  3. app.py +6 -0
  4. requirements.txt +1 -0
Dockerfile ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.12-slim
2
+ ENV DEBIAN_FRONTEND=noninteractive
3
+ RUN apt-get update && \
4
+ apt-get upgrade -y && \
5
+ apt-get install -y --no-install-recommends \
6
+ # gradio dependencies \
7
+ ffmpeg && \
8
+ # clean up
9
+ apt-get clean && \
10
+ rm -rf /var/lib/apt/lists/*
11
+
12
+ RUN useradd -m -u 1000 user
13
+ USER user
14
+ ENV HOME=/home/user \
15
+ PATH=/home/user/.local/bin:${PATH}
16
+ WORKDIR ${HOME}/app
17
+
18
+ RUN pip3 install --no-cache-dir -U pip setuptools wheel && \
19
+ pip3 install "huggingface-hub==0.29.1" "hf-transfer==0.1.9"
20
+
21
+ COPY --chown=1000 . ${HOME}/app
22
+ RUN pip3 install -r ${HOME}/app/requirements.txt
23
+
24
+ ENV PYTHONPATH=${HOME}/app \
25
+ PYTHONUNBUFFERED=1 \
26
+ HF_HUB_ENABLE_HF_TRANSFER=1 \
27
+ GRADIO_NUM_PORTS=1 \
28
+ GRADIO_SERVER_NAME=0.0.0.0 \
29
+ TQDM_POSITION=-1 \
30
+ TQDM_MININTERVAL=1 \
31
+ SYSTEM=spaces
32
+ CMD ["python", "app.py"]
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Gr Login Button In Docker
3
  emoji: 🌖
4
  colorFrom: gray
5
  colorTo: green
6
  sdk: docker
7
  pinned: false
 
 
 
8
  ---
9
 
10
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: gr.LoginButton in Docker
3
  emoji: 🌖
4
  colorFrom: gray
5
  colorTo: green
6
  sdk: docker
7
  pinned: false
8
+ hf_oauth: true
9
+ hf_oauth_scopes:
10
+ - inference-api
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ with gr.Blocks() as demo:
4
+ button = gr.LoginButton("Sign in")
5
+ gr.load("models/meta-llama/Llama-3.2-3B-Instruct", provider="sambanova", accept_token=button)
6
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio[oauth]