import gradio as gr def greet(name): return "Hello " + name + "!" css = ''' .instruction{position: absolute; top: 0;right: 0;margin-top: 0px !important} .arrow{position: absolute;top: 0;right: -8px;margin-top: -8px !important} #component-4, #component-3, #component-10{min-height: 0} ''' def swap_values_files(files): if files: return(len(files)*100) else: return 400 with gr.Blocks(css=css) as demo: with gr.Box(): # You can remove this part here for your local clone gr.HTML('''

Attention - This Space doesn't work in this shared UI

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! 🤑

''') gr.Markdown("# Dreambooth training") gr.Markdown("Customize Stable Diffusion by training it with few-shot examples") with gr.Row(): gr.Dropdown(label="What would you like to train?", choices=["object", "person", "style"], value="object", interactive=True) with gr.Column(): with gr.Box(): 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) gr.Markdown("You should try using words the model doesn't know. Don't use names or well known concepts.") with gr.Row(): files = gr.File(label="Upload your images", file_count="multiple") with gr.Column(): 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 fully liable for image you use") gr.HTML('''''') with gr.Accordion("Advanced Settings", open=False): steps = gr.Number(label="How many steps", value=400) files.change(fn=swap_values_files, inputs=[files], outputs=[steps]) greet_btn = gr.Button("Start Training") greet_btn.click(fn=greet, inputs=[], outputs=[]) demo.launch()