Spaces:
Running
Running
Update
Browse files
app.py
CHANGED
|
@@ -43,24 +43,13 @@ from app_scribble_interactive import \
|
|
| 43 |
from app_seg import create_demo as create_demo_seg
|
| 44 |
from model import Model
|
| 45 |
|
| 46 |
-
DESCRIPTION = '
|
| 47 |
-
|
| 48 |
-
This is an unofficial demo for [https://github.com/lllyasviel/ControlNet](https://github.com/lllyasviel/ControlNet).
|
| 49 |
-
|
| 50 |
-
If you are interested in trying out other base models, check out [this Space](https://huggingface.co/spaces/hysts/ControlNet-with-other-models) as well.
|
| 51 |
-
'''
|
| 52 |
|
| 53 |
SPACE_ID = os.getenv('SPACE_ID')
|
| 54 |
ALLOW_CHANGING_BASE_MODEL = SPACE_ID != 'hysts/ControlNet'
|
| 55 |
|
| 56 |
-
if not ALLOW_CHANGING_BASE_MODEL:
|
| 57 |
-
DESCRIPTION += 'In this Space, the base model is not allowed to be changed so as not to slow down the demo, but it can be changed if you duplicate the Space.'
|
| 58 |
-
|
| 59 |
if SPACE_ID is not None:
|
| 60 |
-
DESCRIPTION += f'''<p>For faster inference without waiting in queue, you may duplicate the space and upgrade to GPU in settings
|
| 61 |
-
<a href="https://huggingface.co/spaces/{SPACE_ID}?duplicate=true">
|
| 62 |
-
<img style="margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
|
| 63 |
-
<p/>
|
| 64 |
'''
|
| 65 |
|
| 66 |
MAX_IMAGES = int(os.getenv('MAX_IMAGES', '3'))
|
|
@@ -132,9 +121,18 @@ with gr.Blocks(css='style.css') as demo:
|
|
| 132 |
interactive=ALLOW_CHANGING_BASE_MODEL)
|
| 133 |
with gr.Column(scale=0.3):
|
| 134 |
change_base_model_button = gr.Button('Change base model')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
check_base_model_button.click(fn=lambda: model.base_model_id,
|
| 137 |
-
outputs=current_base_model
|
|
|
|
| 138 |
base_model_id.submit(fn=model.set_base_model,
|
| 139 |
inputs=base_model_id,
|
| 140 |
outputs=current_base_model)
|
|
|
|
| 43 |
from app_seg import create_demo as create_demo_seg
|
| 44 |
from model import Model
|
| 45 |
|
| 46 |
+
DESCRIPTION = '# [ControlNet](https://github.com/lllyasviel/ControlNet)'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
SPACE_ID = os.getenv('SPACE_ID')
|
| 49 |
ALLOW_CHANGING_BASE_MODEL = SPACE_ID != 'hysts/ControlNet'
|
| 50 |
|
|
|
|
|
|
|
|
|
|
| 51 |
if SPACE_ID is not None:
|
| 52 |
+
DESCRIPTION += f'''<p>For faster inference without waiting in queue, you may duplicate the space and upgrade to GPU in settings. <a href="https://huggingface.co/spaces/{SPACE_ID}?duplicate=true"><img style="display: inline; margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space" /></a></p>
|
|
|
|
|
|
|
|
|
|
| 53 |
'''
|
| 54 |
|
| 55 |
MAX_IMAGES = int(os.getenv('MAX_IMAGES', '3'))
|
|
|
|
| 121 |
interactive=ALLOW_CHANGING_BASE_MODEL)
|
| 122 |
with gr.Column(scale=0.3):
|
| 123 |
change_base_model_button = gr.Button('Change base model')
|
| 124 |
+
if not ALLOW_CHANGING_BASE_MODEL:
|
| 125 |
+
gr.Markdown(
|
| 126 |
+
'''The base model is not allowed to be changed in this Space so as not to slow down the demo, but it can be changed if you duplicate the Space. <a href="https://huggingface.co/spaces/{SPACE_ID}?duplicate=true"><img style="display: inline; margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space" /></a>'''
|
| 127 |
+
)
|
| 128 |
+
|
| 129 |
+
gr.Markdown(
|
| 130 |
+
'[Space using Anything-v4.0 as base model](https://huggingface.co/spaces/hysts/ControlNet-with-other-models)'
|
| 131 |
+
)
|
| 132 |
|
| 133 |
check_base_model_button.click(fn=lambda: model.base_model_id,
|
| 134 |
+
outputs=current_base_model,
|
| 135 |
+
queue=False)
|
| 136 |
base_model_id.submit(fn=model.set_base_model,
|
| 137 |
inputs=base_model_id,
|
| 138 |
outputs=current_base_model)
|