fabiogra commited on
Commit
54c5727
1 Parent(s): bce9fad

fix: revert PREPARE_SAMPLES, update dockerfile

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -2
  2. README.md +1 -2
  3. app/helpers.py +4 -2
Dockerfile CHANGED
@@ -28,7 +28,6 @@ RUN chmod +x prepare_samples.sh
28
  EXPOSE 7860
29
 
30
  HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health
31
-
32
- RUN ["./prepare_samples.sh"]
33
 
34
  ENTRYPOINT ["streamlit", "run", "app/header.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
28
  EXPOSE 7860
29
 
30
  HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health
31
+ RUN --mount=type=secret,id=SECRET_EXAMPLE,mode=0444,required=true ./prepare_samples.sh
 
32
 
33
  ENTRYPOINT ["streamlit", "run", "app/header.py", "--server.port=7860", "--server.address=0.0.0.0"]
README.md CHANGED
@@ -76,8 +76,7 @@ You can set the following environment variables to limit the resources used by t
76
  - ENV_LIMITATION=true
77
  - LIMIT_CPU=true
78
 
79
- If you want to use disable the processing the samples used in the demo, you need to set the env variable `DISABLE_SAMPLES=true`
80
-
81
  ---
82
  ## About
83
 
 
76
  - ENV_LIMITATION=true
77
  - LIMIT_CPU=true
78
 
79
+ If you want to use a prepare the samples used in the demo, you need to set the env variable `PREPARE_SAMPLES=true`
 
80
  ---
81
  ## About
82
 
app/helpers.py CHANGED
@@ -66,10 +66,12 @@ def plot_audio(_audio_segment: AudioSegment, *args, **kwargs) -> Image.Image:
66
 
67
  @st.cache_data(show_spinner=False)
68
  def load_list_of_songs(path="sample_songs.json"):
69
- if os.environ.get("DISABLE_SAMPLES") is None:
70
  return json.load(open(path))
71
  else:
72
- st.error("`DISABLE_SAMPLES` is set. No examples available.")
 
 
73
 
74
 
75
  def get_random_song():
 
66
 
67
  @st.cache_data(show_spinner=False)
68
  def load_list_of_songs(path="sample_songs.json"):
69
+ if os.environ.get("PREPARE_SAMPLES"):
70
  return json.load(open(path))
71
  else:
72
+ st.error(
73
+ "No examples available. You need to set the environment variable `PREPARE_SAMPLES=true`"
74
+ )
75
 
76
 
77
  def get_random_song():