Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files66 unmodified lines67686970717266 unmodified linesif lora_id:pipe.unload_lora_weights()66 unmodified lines67686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518666 unmodified linesif lora_id:pipe.unload_lora_weights()examples = ["a tiny astronaut hatching from an egg on the moon","a cat holding a sign that says hello world","an anime illustration of a wiener schnitzel",]css="""#col-container {margin: 0 auto;max-width: 520px;}"""with gr.Blocks(css=css) as demo:with gr.Column(elem_id="col-container"):gr.Markdown(f"""# FLUX.1 [dev] LoRA12B param rectified flow transformer guidance-distilled from [FLUX.1 [pro]](https://blackforestlabs.ai/)[[non-commercial license](https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md)] [[blog](https://blackforestlabs.ai/announcing-black-forest-labs/)] [[model](https://huggingface.co/black-forest-labs/FLUX.1-dev)]""")with gr.Row():prompt = gr.Text(label="Prompt",show_label=False,max_lines=1,placeholder="Enter your prompt",container=False,)run_button = gr.Button("Run", scale=0)result = gr.Image(label="Result", show_label=False)with gr.Accordion("Advanced Settings", open=False):seed = gr.Slider(label="Seed",minimum=0,maximum=MAX_SEED,step=1,value=0,)randomize_seed = gr.Checkbox(label="Randomize seed", value=True)with gr.Row():width = gr.Slider(label="Width",minimum=256,maximum=MAX_IMAGE_SIZE,step=8,value=1024,)height = gr.Slider(label="Height",minimum=256,maximum=MAX_IMAGE_SIZE,step=8,value=1024,)with gr.Row():guidance_scale = gr.Slider(label="Guidance Scale",minimum=1,maximum=15,step=0.1,value=3.5,)num_inference_steps = gr.Slider(label="Number of inference steps",minimum=1,maximum=50,step=1,value=28,)with gr.Row():lora_id = gr.Textbox(label="LoRA Model ID (HuggingFace path)",placeholder="username/lora-model",max_lines=1)lora_scale = gr.Slider(label="LoRA Scale",minimum=0,maximum=2,step=0.01,value=0.95,)gr.Examples(examples = examples,fn = infer,inputs = [prompt],outputs = [result, seed],cache_examples="lazy")gr.on(triggers=[run_button.click, prompt.submit],fn = infer,inputs = [prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps,lora_id,lora_scale],outputs = [result, seed])demo.launch()
app.py+114