pcuenq HF staff commited on
Commit
488e489
1 Parent(s): 2ad7fc7

Docker with llama.cpp

Browse files
Files changed (3) hide show
  1. Dockerfile +43 -0
  2. app.py +7 -0
  3. requirements.txt +2 -0
Dockerfile ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10.14
2
+
3
+ # Install some assorted build and dev libraries
4
+ ARG DEBIAN_FRONTEND=noninteractive
5
+ ENV TZ=Europe/Paris
6
+ RUN apt-get update && apt-get install -y \
7
+ git \
8
+ jq \
9
+ make build-essential libssl-dev zlib1g-dev \
10
+ libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
11
+ libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
12
+
13
+ # User
14
+ RUN useradd -m -u 1000 user
15
+ USER user
16
+ ENV HOME /home/user
17
+ ENV PATH $HOME/.local/bin:$PATH
18
+ WORKDIR $HOME
19
+ RUN mkdir app
20
+ WORKDIR $HOME/app
21
+
22
+ # Build llama.cpp (CPU, only `quantize`)
23
+ # Should we pin a known commit?
24
+ RUN git clone https://github.com/ggerganov/llama.cpp.git
25
+ WORKDIR $HOME/app/llama.cpp
26
+ RUN make quantize
27
+ WORKDIR $HOME/app
28
+
29
+ # App and Python reqs
30
+ # Should we pin versions here?
31
+ COPY --chown=user ./ $HOME/app
32
+ RUN pip install --no-cache-dir -r requirements.txt
33
+
34
+ # These may be enough to trigger a gradio Space
35
+ #ENV PYTHONPATH $HOME/app
36
+ #ENV PYTHONUNBUFFERED 1
37
+ #ENV GRADIO_ALLOW_FLAGGING never
38
+ #ENV GRADIO_NUM_PORTS 1
39
+ #ENV GRADIO_SERVER_NAME 0.0.0.0
40
+ #ENV GRADIO_THEME huggingface
41
+ #ENV SYSTEM spaces
42
+
43
+ CMD ["python", "app.py"]
app.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def greet(name):
4
+ return "Hello " + name + "!"
5
+
6
+ demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio
2
+ huggingface-hub