Spaces:
Runtime error
Runtime error
Commit
•
4ce0eba
1
Parent(s):
e9eed9e
Update app.py
Browse files
app.py
CHANGED
@@ -46,16 +46,16 @@ def swap_text(option, base):
|
|
46 |
if(option == "object"):
|
47 |
instance_prompt_example = "cttoy"
|
48 |
freeze_for = 30
|
49 |
-
return [f"You are going to train `object`(s), upload 5-10 images of each object you are planning on training on from different angles/perspectives. You can use services like <a style='text-decoration: underline' href='https://www.birme.net/?target_width={resize_width}&target_height={resize_width}'>birme</a> for smart cropping. {mandatory_liability}:", '''<img src="file/cat-toy.png" />''', f"You should name your concept with a unique made up word that has low chance of the model already knowing it (e.g.: `{instance_prompt_example}` here). Images will be automatically cropped to {resize_width}x{resize_width}.", freeze_for, gr.update(visible=False)]
|
50 |
elif(option == "person"):
|
51 |
instance_prompt_example = "julcto"
|
52 |
freeze_for = 70
|
53 |
show_prior_preservation = True if base != "v2-768" else False
|
54 |
-
return [f"You are going to train a `person`(s), upload 10-20 images of each person you are planning on training on from different angles/perspectives. You can use services like <a style='text-decoration: underline' href='https://www.birme.net/?target_width={resize_width}&target_height={resize_width}'>birme</a> for smart cropping. {mandatory_liability}:", '''<img src="file/person.png" />''', f"You should name your concept with a unique made up word that has low chance of the model already knowing it (e.g.: `{instance_prompt_example}` here). Images will be automatically cropped to {resize_width}x{resize_width}.", freeze_for, gr.update(visible=True)]
|
55 |
elif(option == "style"):
|
56 |
instance_prompt_example = "trsldamrl"
|
57 |
freeze_for = 10
|
58 |
-
return [f"You are going to train a `style`, upload 10-20 images of the style you are planning on training on. You can use services like <a style='text-decoration: underline' href='https://www.birme.net/?target_width={resize_width}&target_height={resize_width}'>birme</a> for smart cropping. Name the files with the words you would like {mandatory_liability}:", '''<img src="file/trsl_style.png" />''', f"You should name your concept with a unique made up word that has low chance of the model already knowing it (e.g.: `{instance_prompt_example}` here). Images will be automatically cropped to {resize_width}x{resize_width}", freeze_for, gr.update(visible=False)]
|
59 |
|
60 |
def swap_base_model(selected_model):
|
61 |
if(not is_shared_ui or not is_gpu_associated):
|
@@ -399,7 +399,7 @@ def check_status(top_description):
|
|
399 |
update_top_tag = gr.update(value=f'''
|
400 |
<div class="gr-prose" style="max-width: 80%">
|
401 |
<h2>Your model has finished training ✅</h2>
|
402 |
-
<p>Yay, congratulations on training your model. Scroll down to play with with it, save it (either downloading it or on the Hugging Face Hub). Once you are done, your model is safe, and you don't want to train a new one, go to the <a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}">settings page</a> and downgrade your Space to a CPU Basic</p>
|
403 |
</div>
|
404 |
''')
|
405 |
else:
|
@@ -442,7 +442,7 @@ with gr.Blocks(css=css) as demo:
|
|
442 |
top_description = gr.HTML(f'''
|
443 |
<div class="gr-prose" style="max-width: 80%">
|
444 |
<h2>Attention - This Space doesn't work in this shared UI</h2>
|
445 |
-
<p>For it to work, you can either run locally or duplicate the Space and run it on your own profile using a (paid) private T4 GPU for training. As each T4 costs US$0.60/h, it should cost < US$1 to train most models using default settings! <a class="duplicate-button" style="display:inline-block" href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}?duplicate=true"><img 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>
|
446 |
<img class="instruction" src="file/duplicate.png">
|
447 |
<img class="arrow" src="file/arrow.png" />
|
448 |
</div>
|
@@ -459,7 +459,7 @@ with gr.Blocks(css=css) as demo:
|
|
459 |
top_description = gr.HTML(f'''
|
460 |
<div class="gr-prose" style="max-width: 80%">
|
461 |
<h2>You have successfully duplicated the Dreambooth Training Space 🎉</h2>
|
462 |
-
<p>There's only one step left before you can train your model: <a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}/settings" style="text-decoration: underline">attribute a <b>T4 GPU</b> to it (via the Settings tab)</a> and run the training below. Other GPUs are not compatible for now. You will be billed by the minute from when you activate the GPU until when it is turned it off.</p>
|
463 |
</div>
|
464 |
''')
|
465 |
else:
|
|
|
46 |
if(option == "object"):
|
47 |
instance_prompt_example = "cttoy"
|
48 |
freeze_for = 30
|
49 |
+
return [f"You are going to train `object`(s), upload 5-10 images of each object you are planning on training on from different angles/perspectives. You can use services like <a style='text-decoration: underline' target='_blank' href='https://www.birme.net/?target_width={resize_width}&target_height={resize_width}'>birme</a> for smart cropping. {mandatory_liability}:", '''<img src="file/cat-toy.png" />''', f"You should name your concept with a unique made up word that has low chance of the model already knowing it (e.g.: `{instance_prompt_example}` here). Images will be automatically cropped to {resize_width}x{resize_width}.", freeze_for, gr.update(visible=False)]
|
50 |
elif(option == "person"):
|
51 |
instance_prompt_example = "julcto"
|
52 |
freeze_for = 70
|
53 |
show_prior_preservation = True if base != "v2-768" else False
|
54 |
+
return [f"You are going to train a `person`(s), upload 10-20 images of each person you are planning on training on from different angles/perspectives. You can use services like <a style='text-decoration: underline' target='_blank' href='https://www.birme.net/?target_width={resize_width}&target_height={resize_width}'>birme</a> for smart cropping. {mandatory_liability}:", '''<img src="file/person.png" />''', f"You should name your concept with a unique made up word that has low chance of the model already knowing it (e.g.: `{instance_prompt_example}` here). Images will be automatically cropped to {resize_width}x{resize_width}.", freeze_for, gr.update(visible=True)]
|
55 |
elif(option == "style"):
|
56 |
instance_prompt_example = "trsldamrl"
|
57 |
freeze_for = 10
|
58 |
+
return [f"You are going to train a `style`, upload 10-20 images of the style you are planning on training on. You can use services like <a style='text-decoration: underline' target='_blank' href='https://www.birme.net/?target_width={resize_width}&target_height={resize_width}'>birme</a> for smart cropping. Name the files with the words you would like {mandatory_liability}:", '''<img src="file/trsl_style.png" />''', f"You should name your concept with a unique made up word that has low chance of the model already knowing it (e.g.: `{instance_prompt_example}` here). Images will be automatically cropped to {resize_width}x{resize_width}", freeze_for, gr.update(visible=False)]
|
59 |
|
60 |
def swap_base_model(selected_model):
|
61 |
if(not is_shared_ui or not is_gpu_associated):
|
|
|
399 |
update_top_tag = gr.update(value=f'''
|
400 |
<div class="gr-prose" style="max-width: 80%">
|
401 |
<h2>Your model has finished training ✅</h2>
|
402 |
+
<p>Yay, congratulations on training your model. Scroll down to play with with it, save it (either downloading it or on the Hugging Face Hub). Once you are done, your model is safe, and you don't want to train a new one, go to the <a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}" target="_blank">settings page</a> and downgrade your Space to a CPU Basic</p>
|
403 |
</div>
|
404 |
''')
|
405 |
else:
|
|
|
442 |
top_description = gr.HTML(f'''
|
443 |
<div class="gr-prose" style="max-width: 80%">
|
444 |
<h2>Attention - This Space doesn't work in this shared UI</h2>
|
445 |
+
<p>For it to work, you can either run locally or duplicate the Space and run it on your own profile using a (paid) private T4 GPU for training. As each T4 costs US$0.60/h, it should cost < US$1 to train most models using default settings! <a class="duplicate-button" style="display:inline-block" target="_blank" href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}?duplicate=true"><img 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>
|
446 |
<img class="instruction" src="file/duplicate.png">
|
447 |
<img class="arrow" src="file/arrow.png" />
|
448 |
</div>
|
|
|
459 |
top_description = gr.HTML(f'''
|
460 |
<div class="gr-prose" style="max-width: 80%">
|
461 |
<h2>You have successfully duplicated the Dreambooth Training Space 🎉</h2>
|
462 |
+
<p>There's only one step left before you can train your model: <a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}/settings" style="text-decoration: underline" target="_blank">attribute a <b>T4 GPU</b> to it (via the Settings tab)</a> and run the training below. Other GPUs are not compatible for now. You will be billed by the minute from when you activate the GPU until when it is turned it off.</p>
|
463 |
</div>
|
464 |
''')
|
465 |
else:
|