multimodalart HF staff commited on
Commit
c4b99ca
1 Parent(s): 9a7742a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -18
app.py CHANGED
@@ -36,15 +36,15 @@ def swap_text(option):
36
  if(option == "object"):
37
  instance_prompt_example = "cttoy"
38
  freeze_for = 50
39
- 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. {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)", freeze_for]
40
  elif(option == "person"):
41
  instance_prompt_example = "julcto"
42
  freeze_for = 100
43
- 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. {mandatory_liability}:", '''<img src="file/cat-toy.png" />''', f"You should name the files with a unique word that represent your concept (like `{instance_prompt_example}` in this example). You can train multiple concepts as well.", freeze_for]
44
  elif(option == "style"):
45
- instance_prompt_example = "mspolstyll"
46
  freeze_for = 10
47
- return [f"You are going to train a `style`, upload 10-20 images of the style you are planning on training on. Name the files with the words you would like {mandatory_liability}:", '''<img src="file/cat-toy.png" />''', f"You should name your files with a unique word that represent your concept (as `{instance_prompt_example}` for example). You can train multiple concepts as well.", freeze_for]
48
 
49
  def train(*inputs):
50
  file_counter = 0
@@ -165,28 +165,25 @@ def train(*inputs):
165
 
166
  with gr.Blocks(css=css) as demo:
167
  with gr.Box():
168
- # You can remove this part here for your local clone
169
- gr.HTML('''
170
- <div class="gr-prose" style="max-width: 80%">
171
- <h2>Attention - This Space doesn't work in this shared UI</h2>
172
- <p>For it to work, you have to duplicate the Space and run it on your own profile where a (paid) private GPU will be attributed to it during runtime. It will cost you < US$1 to train a model on default settings! 🤑</p>
173
- <img class="instruction" src="file/duplicate.png">
174
- <img class="arrow" src="file/arrow.png" />
175
- </div>
176
- ''')
177
  gr.Markdown("# Dreambooth training")
178
  gr.Markdown("Customize Stable Diffusion by giving it with few-shot examples")
179
  with gr.Row():
180
  type_of_thing = gr.Dropdown(label="What would you like to train?", choices=["object", "person", "style"], value="object", interactive=True)
181
- #with gr.Column():
182
- #with gr.Box():
183
- # gr.Textbox(label="What prompt you would like to train it on", value="The photo of a cttoy", interactive=True).style(container=False, item_container=False)
184
- # gr.Markdown("You should try using words the model doesn't know. Don't use names or well known concepts.")
185
  with gr.Row():
186
  with gr.Column():
187
  thing_description = gr.Markdown("You are going to train an `object`, upload 5-10 images of the object you are planning on training on from different angles/perspectives. You must have the right to do so and you are liable for the images you use")
188
  thing_image_example = gr.HTML('''<img src="file/cat-toy.png" />''')
189
- things_naming = gr.Markdown("For training, you should name the files with a unique word that represent your concept (like `cctoy` in this example). You can train multiple concepts by naming multiple images at once. Images will be automatically cropped to 512x512.")
190
  with gr.Column():
191
  file_collection = []
192
  concept_collection = []
 
36
  if(option == "object"):
37
  instance_prompt_example = "cttoy"
38
  freeze_for = 50
39
+ 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. {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 512x512.", freeze_for]
40
  elif(option == "person"):
41
  instance_prompt_example = "julcto"
42
  freeze_for = 100
43
+ 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. {mandatory_liability}:", '''<img src="file/person.png" />''', f"You should name the files with a unique word that represent your concept (e.g.: `{instance_prompt_example}` here). Images will be automatically cropped to 512x512.", freeze_for]
44
  elif(option == "style"):
45
+ instance_prompt_example = "trsldamrl"
46
  freeze_for = 10
47
+ return [f"You are going to train a `style`, upload 10-20 images of the style you are planning on training on. Name the files with the words you would like {mandatory_liability}:", '''<img src="file/trsl_style.png" />''', f"You should name your files with a unique word that represent your concept (e.g.: `{instance_prompt_example}` here). Images will be automatically cropped to 512x512.", freeze_for]
48
 
49
  def train(*inputs):
50
  file_counter = 0
 
165
 
166
  with gr.Blocks(css=css) as demo:
167
  with gr.Box():
168
+ if "IS_SHARED_UI" in os.environ:
169
+ gr.HTML('''
170
+ <div class="gr-prose" style="max-width: 80%">
171
+ <h2>Attention - This Space doesn't work in this shared UI</h2>
172
+ <p>For it to work, you have to duplicate the Space and run it on your own profile where a (paid) private GPU will be attributed to it during runtime. It will cost you < US$1 to train a model on default settings! 🤑</p>
173
+ <img class="instruction" src="file/duplicate.png">
174
+ <img class="arrow" src="file/arrow.png" />
175
+ </div>
176
+ ''')
177
  gr.Markdown("# Dreambooth training")
178
  gr.Markdown("Customize Stable Diffusion by giving it with few-shot examples")
179
  with gr.Row():
180
  type_of_thing = gr.Dropdown(label="What would you like to train?", choices=["object", "person", "style"], value="object", interactive=True)
181
+
 
 
 
182
  with gr.Row():
183
  with gr.Column():
184
  thing_description = gr.Markdown("You are going to train an `object`, upload 5-10 images of the object you are planning on training on from different angles/perspectives. You must have the right to do so and you are liable for the images you use")
185
  thing_image_example = gr.HTML('''<img src="file/cat-toy.png" />''')
186
+ things_naming = gr.Markdown("You should name your concept with a unique made up word that has low chance of the model already knowing it (e.g.: `cttoy` here). Images will be automatically cropped to 512x512.")
187
  with gr.Column():
188
  file_collection = []
189
  concept_collection = []