Spaces:
Sleeping
Sleeping
Update app.py
Browse files154 unmodified lines1551561571581591601611621631641655 unmodified lines1711721731741751761771786 unmodified lines1851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332349 unmodified lines244245246247248249250251252154 unmodified lines}"""# Build the Gradio UI with Blockswith gr.Blocks(theme=theme, css=css) as app:# Add a title to the appgr.HTML("<center><h1>🎨 Stable Diffusion 3.5 Large + 🇬🇧</h1></center>")with gr.Tab(label="Image To Prompt"):with gr.Row():with gr.Column(scale=4):input_img = gr.Image(label="Input Picture",height=320, type="filepath")5 unmodified linesclear_prompt.click(lambda: (None, None), None, [input_img, output_text], queue=False, show_api=False)submit_btn.click(feifeichat, [input_img], [output_text])with gr.Tab(label="Generate Image"):with gr.Row():with gr.Column(scale=4):with gr.Row():6 unmodified lineswith gr.Accordion("Advanced Options", open=True):with gr.Column(scale=1):negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="What should not be in the image", value="( (((hands:-1.25))), physical-defects:2, unhealthy-deformed-joints:2, unhealthy-hands:2, out of frame, (((bad face))), (bad-image-v2-39000:1.3), (((out of frame))), deformed body features, (((poor facial details))), (poorly drawn face:1.3), jpeg artifacts, (missing arms:1.1), (missing legs:1.1), (extra arms:1.2), (extra legs:1.2), [asymmetrical features], warped expressions, distorted eyes ", lines=6, elem_id="negative-prompt-text-input")width = gr.Slider(label="Width",minimum=512,maximum=1280,step=8,value=896,)height = gr.Slider(label="Height",minimum=512,maximum=1280,step=8,value=1152,)method = gr.Dropdown(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ 2S a Karras", "DPM2 a Karras", "DPM2 Karras", "DPM++ SDE Karras", "DEIS", "LMS", "DPM Adaptive", "DPM++ 2M", "DPM2 Ancestral", "DPM++ S", "DPM++ SDE", "DDPM", "DPM Fast", "dpmpp_2s_ancestral", "Euler", "Euler CFG PP", "Euler a", "Euler Ancestral", "Euler+beta", "Heun", "Heun PP2", "DDIM", "LMS Karras", "PLMS", "UniPC", "UniPC BH2"])steps = gr.Slider(label="Sampling steps",minimum=1,maximum=100,step=1,value=24,)cfg = gr.Slider(label="CFG Scale",minimum=3.5,maximum=7,step=0.1,value=3.5,)strength = gr.Slider(label="Strength", value=90, minimum=0, maximum=100, step=10)seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)gr.Examples(examples = examples,inputs = [text_prompt],)# Bind the button to the query function with the added width and height inputstext_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, seed, strength, width, height], outputs=img_output)with gr.Tab("ℹ️ Tips"):with gr.Row():with gr.Column():gr.Markdown("""<div style="max-width: 650px; margin: 2rem auto; padding: 1rem; border-radius: 10px; background-color: #f0f0f0;"><h2 style="float: left; font-size: 1.5rem; margin-bottom: 1rem;">How to Use</h2>9 unmodified lines<p style="margin-top: 1rem; font-style: italic;">*I'm still playing around to try to sort the issue, feel free to let me know if you find a fix</p></div>""")app.queue(default_concurrency_limit=200, max_size=200) # <-- Sets up a queue with default parametersif __name__ == "__main__":app.launch(show_api=False, share=False)154 unmodified lines1551561571581591601611621631645 unmodified lines1701711721731741751761776 unmodified lines1841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332349 unmodified lines244245246247248249250251252253154 unmodified lines}"""# Gradio Interfacewith gr.Blocks(css=css, theme=theme) as app:gr.HTML("<h1><center>Flux Stable Diffusion Lab</center></h1>")with gr.Tab(label="Image To Stable DiffusionPrompt"):with gr.Row():with gr.Column(scale=4):input_img = gr.Image(label="Input Picture",height=320, type="filepath")5 unmodified linesclear_prompt.click(lambda: (None, None), None, [input_img, output_text], queue=False, show_api=False)submit_btn.click(feifeichat, [input_img], [output_text])with gr.Tab(label="Generate Image"):with gr.Row():with gr.Column(scale=4):with gr.Row():6 unmodified lineswith gr.Accordion("Advanced Options", open=True):with gr.Column(scale=1):negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="What should not be in the image", value="( (((hands:-1.25))), physical-defects:2, unhealthy-deformed-joints:2, unhealthy-hands:2, out of frame, (((bad face))), (bad-image-v2-39000:1.3), (((out of frame))), deformed body features, (((poor facial details))), (poorly drawn face:1.3), jpeg artifacts, (missing arms:1.1), (missing legs:1.1), (extra arms:1.2), (extra legs:1.2), [asymmetrical features], warped expressions, distorted eyes ", lines=6, elem_id="negative-prompt-text-input")width = gr.Slider(label="Width",minimum=512,maximum=1280,step=8,value=896,)height = gr.Slider(label="Height",minimum=512,maximum=1280,step=8,value=1152,)method = gr.Dropdown(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ 2S a Karras", "DPM2 a Karras", "DPM2 Karras", "DPM++ SDE Karras", "DEIS", "LMS", "DPM Adaptive", "DPM++ 2M", "DPM2 Ancestral", "DPM++ S", "DPM++ SDE", "DDPM", "DPM Fast", "dpmpp_2s_ancestral", "Euler", "Euler CFG PP", "Euler a", "Euler Ancestral", "Euler+beta", "Heun", "Heun PP2", "DDIM", "LMS Karras", "PLMS", "UniPC", "UniPC BH2"])steps = gr.Slider(label="Sampling steps",minimum=1,maximum=100,step=1,value=24,)cfg = gr.Slider(label="CFG Scale",minimum=3.5,maximum=7,step=0.1,value=3.5,)strength = gr.Slider(label="Strength", value=90, minimum=0, maximum=100, step=10)seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)gr.Examples(examples = examples,inputs = [text_prompt],)# Bind the button to the query function with the added width and height inputstext_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, seed, strength, width, height], outputs=img_output)with gr.Tab("ℹ️ Tips"):with gr.Row():with gr.Column():gr.Markdown("""<div style="max-width: 650px; margin: 2rem auto; padding: 1rem; border-radius: 10px; background-color: #f0f0f0;"><h2 style="float: left; font-size: 1.5rem; margin-bottom: 1rem;">How to Use</h2>9 unmodified lines<p style="margin-top: 1rem; font-style: italic;">*I'm still playing around to try to sort the issue, feel free to let me know if you find a fix</p></div>""")app.queue(default_concurrency_limit=200, max_size=200) # <-- Sets up a queue with default parametersif __name__ == "__main__":app.launch(show_api=False, share=False)
app.py+43-42