Alon77777 commited on
Commit
c4c177a
1 Parent(s): ebfe3be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -45
app.py CHANGED
@@ -449,58 +449,59 @@ def checkbox_swap(checkbox):
449
  return [gr.update(visible=checkbox), gr.update(visible=checkbox), gr.update(visible=checkbox), gr.update(visible=checkbox)]
450
 
451
  with gr.Blocks(css=css) as demo:
452
- gr.HTML(f'''
453
- <div style="text-align: center; max-width: 650px; margin: 0 auto;">
454
- <div
455
- style="
456
- display: inline-flex;
457
- gap: 1.2rem;
458
- font-size: 1.75rem;
459
- margin-bottom: 15px;
460
- width: 700px;
461
- margin: 0 auto;
462
- justify-content: center;
463
- ">
464
- <a href="https://github.com/FlagAI-Open/FlagAI"><img src="https://raw.githubusercontent.com/FlagAI-Open/FlagAI/master/logo.png" alt="FlagAI" width="80%" style="margin: 0 auto;"></a>
465
- </div>
466
- <p style="margin-bottom: 10px; font-size: 94%">
467
- This is a dreambooth Training UI for <a href="https://huggingface.co/BAAI/AltDiffusion-m9" style="text-decoration: underline;">AltDiffusion-m9 model</a>,which is a multilingual image-to-text model supported 9 languages.
468
- You can duplicate this space to your own!<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>
469
- </p>
470
- </div>
471
- ''')
472
  with gr.Box():
473
- if is_shared_ui:
474
- top_description = gr.HTML(f'''
475
- <div class="gr-prose" style="max-width: 80%">
476
- <h2>Attention - This Space doesn't work in this shared UI</h2>
477
- <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!&nbsp;&nbsp;<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>
478
- <img class="instruction" src="file/duplicate.png">
479
- <img class="arrow" src="file/arrow.png" />
480
- </div>
481
- ''')
482
- elif(is_spaces):
483
- if(is_gpu_associated):
 
 
 
 
 
 
 
 
 
 
 
484
  top_description = gr.HTML(f'''
485
- <div class="gr-prose" style="max-width: 80%">
486
- <h2>You have successfully associated a GPU to the Dreambooth Training Space 🎉</h2>
487
- <p>Certify that you got a T4. You can now train your model! You will be billed by the minute from when you activated the GPU until when it is turned it off.</p>
488
- </div>
 
 
489
  ''')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
490
  else:
491
  top_description = gr.HTML(f'''
492
  <div class="gr-prose" style="max-width: 80%">
493
- <h2>You have successfully duplicated the Dreambooth Training Space 🎉</h2>
494
- <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>
495
  </div>
496
- ''')
497
- else:
498
- top_description = gr.HTML(f'''
499
- <div class="gr-prose" style="max-width: 80%">
500
- <h2>You have successfully cloned the Dreambooth Training Space locally 🎉</h2>
501
- <p>Do a <code>pip install requirements-local.txt</code></p>
502
- </div>
503
- ''')
504
 
505
  gr.Markdown("# Dreambooth Training UI 💭")
506
  gr.Markdown("Customize AltDiffusion and AltDiffusion-m9(ⁿᵉʷ!) by giving it a few examples of a concept. Based on the [🧨 diffusers](https://github.com/huggingface/diffusers) implementation, additional techniques from [TheLastBen](https://github.com/TheLastBen/diffusers) and [ShivamShrirao](https://github.com/ShivamShrirao/diffusers)")
 
449
  return [gr.update(visible=checkbox), gr.update(visible=checkbox), gr.update(visible=checkbox), gr.update(visible=checkbox)]
450
 
451
  with gr.Blocks(css=css) as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
452
  with gr.Box():
453
+ gr.HTML(f'''
454
+ <div style="text-align: center; max-width: 650px; margin: 0 auto;">
455
+ <div
456
+ style="
457
+ display: inline-flex;
458
+ gap: 1.2rem;
459
+ font-size: 1.75rem;
460
+ margin-bottom: 15px;
461
+ width: 700px;
462
+ margin: 0 auto;
463
+ justify-content: center;
464
+ ">
465
+ <a href="https://github.com/FlagAI-Open/FlagAI"><img src="https://raw.githubusercontent.com/FlagAI-Open/FlagAI/master/logo.png" alt="FlagAI" width="80%" style="margin: 0 auto;"></a>
466
+ </div>
467
+ <p style="margin-bottom: 10px; font-size: 94%">
468
+ This is a dreambooth Training UI for <a href="https://huggingface.co/BAAI/AltDiffusion-m9" style="text-decoration: underline;">AltDiffusion-m9 model</a>,which is a multilingual image-to-text model supported 9 languages.
469
+ You can duplicate this space to your own!<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>
470
+ </p>
471
+ </div>
472
+ ''')
473
+ with gr.Box():
474
+ if is_shared_ui:
475
  top_description = gr.HTML(f'''
476
+ <div class="gr-prose" style="max-width: 80%">
477
+ <h2>Attention - This Space doesn't work in this shared UI</h2>
478
+ <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!&nbsp;&nbsp;<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>
479
+ <img class="instruction" src="file/duplicate.png">
480
+ <img class="arrow" src="file/arrow.png" />
481
+ </div>
482
  ''')
483
+ elif(is_spaces):
484
+ if(is_gpu_associated):
485
+ top_description = gr.HTML(f'''
486
+ <div class="gr-prose" style="max-width: 80%">
487
+ <h2>You have successfully associated a GPU to the Dreambooth Training Space 🎉</h2>
488
+ <p>Certify that you got a T4. You can now train your model! You will be billed by the minute from when you activated the GPU until when it is turned it off.</p>
489
+ </div>
490
+ ''')
491
+ else:
492
+ top_description = gr.HTML(f'''
493
+ <div class="gr-prose" style="max-width: 80%">
494
+ <h2>You have successfully duplicated the Dreambooth Training Space 🎉</h2>
495
+ <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>
496
+ </div>
497
+ ''')
498
  else:
499
  top_description = gr.HTML(f'''
500
  <div class="gr-prose" style="max-width: 80%">
501
+ <h2>You have successfully cloned the Dreambooth Training Space locally 🎉</h2>
502
+ <p>Do a <code>pip install requirements-local.txt</code></p>
503
  </div>
504
+ ''')
 
 
 
 
 
 
 
505
 
506
  gr.Markdown("# Dreambooth Training UI 💭")
507
  gr.Markdown("Customize AltDiffusion and AltDiffusion-m9(ⁿᵉʷ!) by giving it a few examples of a concept. Based on the [🧨 diffusers](https://github.com/huggingface/diffusers) implementation, additional techniques from [TheLastBen](https://github.com/TheLastBen/diffusers) and [ShivamShrirao](https://github.com/ShivamShrirao/diffusers)")