achyuth1344 commited on
Commit
8fc3fae
β€’
1 Parent(s): c0c823c

Upload 2 files

Browse files
Files changed (2) hide show
  1. env_patch.py +3 -0
  2. header_patch.py +29 -0
env_patch.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+
2
+ is_spaces = True if "SPACE_ID" in os.environ else False
3
+ is_shared_ui = True if "IS_SHARED_UI" in os.environ else False
header_patch.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ with gr.Box(visible=is_spaces):
2
+ if(is_spaces and is_shared_ui):
3
+ gr.HTML(f'''
4
+ <div class="gr-prose" style="max-width: 80%">
5
+ <p>🚨 We have a new version ✨ please try it and add a comment if you find any issues. <a style="color: #00ff00;" href="https://huggingface.co/spaces/achyuth1344/stable-diffusion-webui">https://huggingface.co/spaces/achyuth1344/stable-diffusion-webui</a></p>
6
+ <br>
7
+ <p>🚧 (WIP) Automatic1111 Stable Diffusion Web UI on πŸ€— Hugging Face Spaces | Running model: Linaqruf/anything-v3.0</p>
8
+ <p>You can duplicate this Space to run it privately without a queue and load additional checkpoints.&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>&nbsp;&nbsp;<a style="display:inline-block" href="https://github.com/camenduru/stable-diffusion-webui-colab" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>&nbsp;&nbsp;<a style="display:inline-block" href="https://patreon.com/camenduru"><img style="margin: 0" alt="Become A Patreon" src="https://badgen.net/badge/become/a%20patron/F96854"></a>&nbsp;&nbsp;<a style="display:inline-block" href="https://ko-fi.com/camenduru" target="_blank"><img style="margin: 0" alt="Buy a Coffee" src="https://badgen.net/badge/buy/a%20coffee/green?icon=kofi"></a></p>
9
+ <p>πŸ“ How to add private model or embed? πŸ“Ί Tutorial Video: <a href="https://www.youtube.com/channel/UCs_1ej3ysIROjWZVmNw-tyw" style="target=" _blank"="">https://www.youtube.com/channel/UCs_1ej3ysIROjWZVmNw-tyw</a> 🐣 Please follow me for new updates <a href="https://twitter.com/pixiejourney" style="target=" _blank"="">https://twitter.com/pixiejourney</a> </p>
10
+ </div>
11
+ ''')
12
+ elif(is_spaces):
13
+ import torch
14
+ if(not torch.cuda.is_available()):
15
+ gr.HTML(f'''
16
+ <div class="gr-prose" style="max-width: 80%">
17
+ <p>🚧 (WIP) Private Automatic1111 Stable Diffusion Web UI on πŸ€— Hugging Face Spaces</p>
18
+ <p>This Space is currently running on CPU, this WebUI may not run on CPU πŸ₯Ά, 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>&nbsp;&nbsp;<a style="display:inline-block" href="https://github.com/achyuth4" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>&nbsp;&nbsp;<a style="display:inline-block" href="https://patreon.com/camenduru"><img style="margin: 0" alt="Become A Patreon" src="https://badgen.net/badge/become/a%20patron/F96854"></a>&nbsp;&nbsp;<a style="display:inline-block" href="https://ko-fi.com/achyuth4" target="_blank"><img style="margin: 0" alt="Buy a Coffee" src="https://badgen.net/badge/buy/a%20coffee/green?icon=kofi"></a></p>
19
+ <p>πŸ“ How to add private model or embed? πŸ“Ί Tutorial Video: <a href="https://www.youtube.com/channel/UCs_1ej3ysIROjWZVmNw-tyw" style="target=" _blank"="">https://www.youtube.com/channel/UCs_1ej3ysIROjWZVmNw-tyw</a> 🐣 Please follow me for new updates <a href="https://twitter.com/pixiejourney" style="target=" _blank"="">https://twitter.com/pixiejourney</a> </p>
20
+ </div>
21
+ ''')
22
+ else:
23
+ gr.HTML(f'''
24
+ <div class="gr-prose" style="max-width: 80%">
25
+ <p>🚧 (WIP) Private Automatic1111 Stable Diffusion Web UI on πŸ€— Hugging Face Spaces</p>
26
+ <p>It is running on a GPU πŸ”₯, you can <a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}/settings" style="text-decoration: underline" target="_blank">don't forget to remove the GPU attribution</a> once your are done playing with it&nbsp;&nbsp;<a style="display:inline-block" href="https://github.com/achyuth4" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>&nbsp;&nbsp;<a style="display:inline-block" href="https://patreon.com/achyuth1344"><img style="margin: 0" alt="Become A Patreon" src="https://badgen.net/badge/become/a%20patron/F96854"></a>&nbsp;&nbsp;<a style="display:inline-block" href="https://ko-fi.com/achyuth4" target="_blank"><img style="margin: 0" alt="Buy a Coffee" src="https://badgen.net/badge/buy/a%20coffee/green?icon=kofi"></a></p>
27
+ <p>πŸ“ How to add private model or embed? πŸ“Ί Tutorial Video: <a href="https://www.youtube.com/channel/UCs_1ej3ysIROjWZVmNw-tyw" style="target=" _blank"="">https://www.youtube.com/channel/UCs_1ej3ysIROjWZVmNw-tyw</a> 🐣 Please follow me for new updates <a href="https://twitter.com/pixiejourney" style="target=" _blank"="">https://twitter.com/pixiejourney</a> </p>
28
+ </div>
29
+ ''')