Huiran Yu commited on
Commit
56a0184
·
1 Parent(s): 917b2ce

Switch to docker

Browse files
Files changed (4) hide show
  1. Dockerfile +27 -0
  2. README.md +4 -3
  3. app.py +2 -1
  4. requirements.txt +1 -0
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ # System deps for building packages from source
4
+ RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ build-essential python3-dev \
6
+ && rm -rf /var/lib/apt/lists/*
7
+
8
+ WORKDIR /app
9
+
10
+ # Copy requirements first to leverage Docker layer caching
11
+ COPY requirements.txt /app/requirements.txt
12
+
13
+ # Key fix for your madmom/Cython issue:
14
+ # disable build isolation so Cython installed in the environment is visible at build time
15
+ ENV PIP_NO_BUILD_ISOLATION=1
16
+
17
+ RUN pip install --no-cache-dir -U pip setuptools wheel Cython \
18
+ && pip install --no-cache-dir -r /app/requirements.txt
19
+
20
+ # Copy the rest of the repo
21
+ COPY . /app
22
+
23
+ # HF Spaces routes traffic to $PORT (usually 7860). Gradio should listen on it.
24
+ ENV PORT=7860
25
+ EXPOSE 7860
26
+
27
+ CMD ["python", "app.py"]
README.md CHANGED
@@ -3,9 +3,10 @@ title: BeatNet
3
  emoji: 🏢
4
  colorFrom: red
5
  colorTo: gray
6
- sdk: gradio
7
- sdk_version: 5.28.0
8
- python_version: "3.11"
 
9
  app_file: app.py
10
  pinned: false
11
  short_description: Beat detection for music
 
3
  emoji: 🏢
4
  colorFrom: red
5
  colorTo: gray
6
+ sdk: docker
7
+ # sdk_version: 5.28.0
8
+ app_port: 7860
9
+ # python_version: "3.11"
10
  app_file: app.py
11
  pinned: false
12
  short_description: Beat detection for music
app.py CHANGED
@@ -99,4 +99,5 @@ with gr.Blocks() as app:
99
  )
100
 
101
  if __name__ == '__main__':
102
- app.launch(share=True, show_error=True, debug=True)
 
 
99
  )
100
 
101
  if __name__ == '__main__':
102
+ app.launch(server_name="0.0.0.0", server_port=int(os.getenv("PORT", "7860")))
103
+
requirements.txt CHANGED
@@ -1,5 +1,6 @@
1
  pip>=23.1
2
  setuptools>=65
 
3
  git+https://github.com/TEAMuP-dev/pyharp.git@v0.3.0
4
  librosa
5
  cython
 
1
  pip>=23.1
2
  setuptools>=65
3
+ gradio==5.28.0
4
  git+https://github.com/TEAMuP-dev/pyharp.git@v0.3.0
5
  librosa
6
  cython