multimodalart HF staff commited on
Commit
2bd1ca8
1 Parent(s): aa694ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -229,7 +229,7 @@ h3{margin-top: 0}
229
  #component-1{text-align:center}
230
  .main_ui_logged_out{opacity: 0.3; pointer-events: none}
231
  .tabitem{border: 0px}
232
- .group_padding{padding: .5em}
233
  """
234
 
235
  def swap_visibilty(profile: Union[gr.OAuthProfile, None]):
@@ -253,7 +253,7 @@ def update_pricing(steps, oauth_token: Union[gr.OAuthToken, None]):
253
  if(user["canPay"]):
254
  return gr.update(visible=True), cost_preview, gr.update(visible=False), gr.update(visible=True)
255
  else:
256
- pay_disclaimer = f'''## ⚠️ {user["name"]}, your account doesn't have a payment method. Set one up <a href='https://huggingface.co/settings/billing/payment' target='_blank'>here</a> and come back here to train your LoRA<br>'''
257
  return gr.update(visible=True), pay_disclaimer+cost_preview, gr.update(visible=True), gr.update(visible=False)
258
  else:
259
  return gr.update(visible=False), "", gr.update(visible=False), gr.update(visible=True)
@@ -273,16 +273,13 @@ with gr.Blocks(theme=theme, css=css) as demo:
273
  info="This has to be a unique name",
274
  placeholder="e.g.: Persian Miniature Painting style, Cat Toy",
275
  )
276
- # training_option = gr.Radio(
277
- # label="What are you training?", choices=["object", "style", "character", "face", "custom"]
278
- # )
279
  concept_sentence = gr.Textbox(
280
  label="Trigger word/sentence",
281
  info="Trigger word or sentence to be used",
282
  placeholder="uncommon word like p3rs0n or trtcrd, or sentence like 'in the style of CNSTLL'",
283
  interactive=True,
284
  )
285
- with gr.Group(visible=True, elem_classes="group_padding") as image_upload:
286
  with gr.Row():
287
  images = gr.File(
288
  file_types=["image"],
@@ -297,8 +294,7 @@ with gr.Blocks(theme=theme, css=css) as demo:
297
  gr.Markdown(
298
  """# Custom captioning
299
  You can optionally add a custom caption for each image (or use an AI model for this). [trigger] will represent your concept sentence/trigger word.
300
- """
301
- )
302
  do_captioning = gr.Button("Add AI captions with Florence-2")
303
  output_components = [captioning_area]
304
  caption_list = []
@@ -337,8 +333,8 @@ with gr.Blocks(theme=theme, css=css) as demo:
337
  sample_1 = gr.Textbox(label="Test prompt 1")
338
  sample_2 = gr.Textbox(label="Test prompt 2")
339
  sample_3 = gr.Textbox(label="Test prompt 3")
340
- with gr.Group(visible=False, elem_classes="group_padding") as cost_preview:
341
- cost_preview_info = gr.Markdown(elem_id="cost_preview_info")
342
  payment_update = gr.Button("I have set up a payment method", visible=False)
343
  output_components.append(sample)
344
  output_components.append(sample_1)
 
229
  #component-1{text-align:center}
230
  .main_ui_logged_out{opacity: 0.3; pointer-events: none}
231
  .tabitem{border: 0px}
232
+ .group_padding{padding: 1em}
233
  """
234
 
235
  def swap_visibilty(profile: Union[gr.OAuthProfile, None]):
 
253
  if(user["canPay"]):
254
  return gr.update(visible=True), cost_preview, gr.update(visible=False), gr.update(visible=True)
255
  else:
256
+ pay_disclaimer = f'''## ⚠️ {user["name"]}, your account doesn't have a payment method. Set one up <a href='https://huggingface.co/settings/billing/payment' target='_blank'>here</a> and come back here to train your LoRA<br><br>'''
257
  return gr.update(visible=True), pay_disclaimer+cost_preview, gr.update(visible=True), gr.update(visible=False)
258
  else:
259
  return gr.update(visible=False), "", gr.update(visible=False), gr.update(visible=True)
 
273
  info="This has to be a unique name",
274
  placeholder="e.g.: Persian Miniature Painting style, Cat Toy",
275
  )
 
 
 
276
  concept_sentence = gr.Textbox(
277
  label="Trigger word/sentence",
278
  info="Trigger word or sentence to be used",
279
  placeholder="uncommon word like p3rs0n or trtcrd, or sentence like 'in the style of CNSTLL'",
280
  interactive=True,
281
  )
282
+ with gr.Group(visible=True) as image_upload:
283
  with gr.Row():
284
  images = gr.File(
285
  file_types=["image"],
 
294
  gr.Markdown(
295
  """# Custom captioning
296
  You can optionally add a custom caption for each image (or use an AI model for this). [trigger] will represent your concept sentence/trigger word.
297
+ """,elem_classes="group_padding")
 
298
  do_captioning = gr.Button("Add AI captions with Florence-2")
299
  output_components = [captioning_area]
300
  caption_list = []
 
333
  sample_1 = gr.Textbox(label="Test prompt 1")
334
  sample_2 = gr.Textbox(label="Test prompt 2")
335
  sample_3 = gr.Textbox(label="Test prompt 3")
336
+ with gr.Group(visible=False) as cost_preview:
337
+ cost_preview_info = gr.Markdown(elem_id="cost_preview_info", elem_classes="group_padding")
338
  payment_update = gr.Button("I have set up a payment method", visible=False)
339
  output_components.append(sample)
340
  output_components.append(sample_1)