multimodalart HF staff commited on
Commit
b3b2261
1 Parent(s): 3965ed9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -498,6 +498,10 @@ def check_token(token):
498
 
499
  return gr.update(visible=False), gr.update(visible=False)
500
 
 
 
 
 
501
  css = '''.gr-group{background-color: transparent;box-shadow: var(--block-shadow)}
502
  .gr-group .hide-container{padding: 1em; background: var(--block-background-fill) !important}
503
  .gr-group img{object-fit: cover}
@@ -857,6 +861,11 @@ with gr.Blocks(css=css, theme=theme) as demo:
857
  outputs=[no_payment_method, start],
858
  concurrency_limit=50
859
  )
 
 
 
 
 
860
  use_snr_gamma.change(
861
  lambda x: gr.update(visible=x),
862
  inputs=use_snr_gamma,
 
498
 
499
  return gr.update(visible=False), gr.update(visible=False)
500
 
501
+ def check_if_tok(sentence, textual_inversion):
502
+ if "TOK" not in sentence and textual_inversion:
503
+ gr.Warning("⚠️ You've removed the special token TOK from your concept sentence. This will degrade performance as this special token is needed for textual inversion. Use it to describe what you are training.")
504
+
505
  css = '''.gr-group{background-color: transparent;box-shadow: var(--block-shadow)}
506
  .gr-group .hide-container{padding: 1em; background: var(--block-background-fill) !important}
507
  .gr-group img{object-fit: cover}
 
861
  outputs=[no_payment_method, start],
862
  concurrency_limit=50
863
  )
864
+ concept_sentence.change(
865
+ check_if_tok,
866
+ inputs=[concept_sentence, train_text_encoder_ti],
867
+ queue=False
868
+ )
869
  use_snr_gamma.change(
870
  lambda x: gr.update(visible=x),
871
  inputs=use_snr_gamma,