customdiffusion360 commited on
Commit
226ece7
1 Parent(s): dd150fe

docker: change gradio env var

Browse files
Files changed (3) hide show
  1. Dockerfile +2 -2
  2. README.md +1 -0
  3. app.py +4 -2
Dockerfile CHANGED
@@ -21,8 +21,6 @@ RUN conda create -n pose python=3.8
21
  # Make RUN commands use the new environment:
22
  SHELL ["conda", "run", "-n", "pose", "/bin/bash", "-c"]
23
 
24
- # Set gradio env variables?
25
-
26
  RUN pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu118
27
 
28
  RUN pip install -r requirements.txt
@@ -34,4 +32,6 @@ RUN pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"
34
  RUN wget https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors -P pretrained-models
35
  RUN wget https://huggingface.co/stabilityai/sdxl-vae/resolve/main/sdxl_vae.safetensors -P pretrained-models
36
 
 
 
37
  ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "pose", "python", "app.py"]
 
21
  # Make RUN commands use the new environment:
22
  SHELL ["conda", "run", "-n", "pose", "/bin/bash", "-c"]
23
 
 
 
24
  RUN pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu118
25
 
26
  RUN pip install -r requirements.txt
 
32
  RUN wget https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors -P pretrained-models
33
  RUN wget https://huggingface.co/stabilityai/sdxl-vae/resolve/main/sdxl_vae.safetensors -P pretrained-models
34
 
35
+ ENV GRADIO_SERVER_NAME=0.0.0.0
36
+
37
  ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "pose", "python", "app.py"]
README.md CHANGED
@@ -7,6 +7,7 @@ sdk: docker
7
  app_port: 7860
8
  app_file: app.py
9
  pinned: false
 
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
7
  app_port: 7860
8
  app_file: app.py
9
  pinned: false
10
+ suggested_hardeware: a10g-large
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py CHANGED
@@ -153,7 +153,9 @@ MODELS_DIR = "pretrained-models/"
153
 
154
  def select_and_load_model(category, category_single_id):
155
  global current_data, current_model, base_model
156
- current_model = None
 
 
157
  current_model = copy.deepcopy(base_model)
158
 
159
  ### choose model checkpoint and config
@@ -167,7 +169,7 @@ def select_and_load_model(category, category_single_id):
167
  current_model, current_data = load_and_return_model_and_data(config, current_model,
168
  delta_ckpt=delta_ckpt
169
  )
170
-
171
  print(f"Time taken to load delta model: {time.time() - start_time:.2f}s")
172
 
173
  print("!!! model loaded")
 
153
 
154
  def select_and_load_model(category, category_single_id):
155
  global current_data, current_model, base_model
156
+ del current_model
157
+ del current_data
158
+ torch.cuda.empty_cache()
159
  current_model = copy.deepcopy(base_model)
160
 
161
  ### choose model checkpoint and config
 
169
  current_model, current_data = load_and_return_model_and_data(config, current_model,
170
  delta_ckpt=delta_ckpt
171
  )
172
+
173
  print(f"Time taken to load delta model: {time.time() - start_time:.2f}s")
174
 
175
  print("!!! model loaded")