carloscar commited on
Commit
b5f887d
β€’
1 Parent(s): 3e0f622

Added header

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -1
  2. header_patch.py +27 -0
  3. on_start.sh +1 -0
Dockerfile CHANGED
@@ -116,7 +116,7 @@ RUN sed -i -e 's/ outputs=\[/queue=False, &/g' modules/ui.py
116
  RUN sed -i -e 's/ queue=False, / /g' modules/ui.py
117
 
118
  # Copy startup scripts
119
- COPY --chown=user:user run.py on_start.sh config.json ui-config.json shared-config.json shared-ui-config.json /app/stable-diffusion-webui/
120
  RUN chmod +x on_start.sh
121
 
122
  EXPOSE 7860
 
116
  RUN sed -i -e 's/ queue=False, / /g' modules/ui.py
117
 
118
  # Copy startup scripts
119
+ COPY --chown=user:user run.py on_start.sh config.json ui-config.json shared-config.json shared-ui-config.json header_patch.py /app/stable-diffusion-webui/
120
  RUN chmod +x on_start.sh
121
 
122
  EXPOSE 7860
header_patch.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ with gr.Box(visible=os.environ.get("SPACE_ID")):
2
+ if os.environ.get("SPACE_ID") and str(os.environ.get("IS_SHARED_UI", "") or "") not in ("", "0"):
3
+ gr.HTML(f"""
4
+ <div class="gr-prose" style="max-width: 80%">
5
+ <p>Automatic1111 Stable Diffusion Web UI on πŸ€— Hugging Face | Checkpoint: <a href="https://civitai.com/models/10752/the-allys-mix-iii-revolutions" style="target=" _blank"="">theAllysMixIII_v10</a></p>
6
+ <p>Docker setup: <a href="https://huggingface.co/spaces/carloscar/stable-diffusion-webui-docker" style="target=" _blank"="">πŸ€— Hugging Face βž” carloscar/stable-diffusion-webui-docker</a> | <a href="https://github.com/kalaspuff/stable-diffusion-webui-docker" style="target=" _blank"="">πŸ™ GitHub βž” kalaspuff/stable-diffusion-webui-docker</a></p>
7
+ <p>Duplicate this Space to run it privately without a queue + load additional checkpoints, VAE, LoRA models, etc.&nbsp;&nbsp;<a class="duplicate-button" style="display:inline-block" target="_blank" href="https://huggingface.co/spaces/{os.environ["SPACE_ID"]}?duplicate=true"><img style="margin: 0" src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a></p>
8
+ </div>
9
+ """)
10
+ elif os.environ.get("SPACE_ID"):
11
+ import torch
12
+ if not torch.cuda.is_available():
13
+ gr.HTML(f"""
14
+ <div class="gr-prose" style="max-width: 80%">
15
+ <p>Docker setup: <a href="https://huggingface.co/spaces/carloscar/stable-diffusion-webui-docker" style="target=" _blank"="">πŸ€— Hugging Face βž” carloscar/stable-diffusion-webui-docker</a> | <a href="https://github.com/kalaspuff/stable-diffusion-webui-docker" style="target=" _blank"="">πŸ™ GitHub βž” kalaspuff/stable-diffusion-webui-docker</a></p>
16
+ <p>Load additional checkpoints, VAE, LoRA models, etc. Read more on the README at the GitHub link above.</p>
17
+ <p>This Space is currently running on CPU, which may yield very slow results - you can upgrade for a GPU <a href="https://huggingface.co/spaces/{os.environ["SPACE_ID"]}/settings" style="text-decoration: underline" target="_blank">in the Settings tab</a></p>
18
+ </div>
19
+ """)
20
+ else:
21
+ gr.HTML(f"""
22
+ <div class="gr-prose" style="max-width: 80%">
23
+ <p>Docker setup: <a href="https://huggingface.co/spaces/carloscar/stable-diffusion-webui-docker" style="target=" _blank"="">πŸ€— Hugging Face βž” carloscar/stable-diffusion-webui-docker</a> | <a href="https://github.com/kalaspuff/stable-diffusion-webui-docker" style="target=" _blank"="">πŸ™ GitHub βž” kalaspuff/stable-diffusion-webui-docker</a></p>
24
+ <p>Load additional checkpoints, VAE, LoRA models, etc. Read more on the README at the GitHub link above.</p>
25
+ <p>This Space has GPU enabled - remember to remove the GPU from the space <a href="https://huggingface.co/spaces/{os.environ["SPACE_ID"]}/settings" style="text-decoration: underline" target="_blank">in the Settings tab</a> when you're done.</p>
26
+ </div>
27
+ """)
on_start.sh CHANGED
@@ -41,6 +41,7 @@ if [ ${IS_SHARED_UI:-0} != 0 ]; then
41
  sed -i -e '/(train_interface, \"Train\", \"ti\"),/d' /app/stable-diffusion-webui/modules/ui.py
42
  sed -i -e '/extensions_interface, \"Extensions\", \"extensions\"/d' /app/stable-diffusion-webui/modules/ui.py
43
  sed -i -e '/settings_interface, \"Settings\", \"settings\"/d' /app/stable-diffusion-webui/modules/ui.py
 
44
  rm -rf /app/stable-diffusion-webui/scripts /app/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui /app/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser /app/stable-diffusion-webui/extensions/sd-civitai-browser /app/stable-diffusion-webui/extensions/sd-webui-additional-networks
45
  cp -f shared-config.json config.json
46
  cp -f shared-ui-config.json ui-config.json
 
41
  sed -i -e '/(train_interface, \"Train\", \"ti\"),/d' /app/stable-diffusion-webui/modules/ui.py
42
  sed -i -e '/extensions_interface, \"Extensions\", \"extensions\"/d' /app/stable-diffusion-webui/modules/ui.py
43
  sed -i -e '/settings_interface, \"Settings\", \"settings\"/d' /app/stable-diffusion-webui/modules/ui.py
44
+ sed -i -e '/demo:/r /app/stable-diffusion-webui/header_patch.py' /app/stable-diffusion-webui/modules/ui.py
45
  rm -rf /app/stable-diffusion-webui/scripts /app/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui /app/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser /app/stable-diffusion-webui/extensions/sd-civitai-browser /app/stable-diffusion-webui/extensions/sd-webui-additional-networks
46
  cp -f shared-config.json config.json
47
  cp -f shared-ui-config.json ui-config.json