Update app.py
Browse files179 unmodified lines18018118218318418531 unmodified lines2172182192202212224 unmodified lines227228229230231232179 unmodified linesimg = Image.open(BytesIO(response2.content))return imgexamples = ["a beautiful woman with blonde hair and blue eyes","a beautiful woman with brown hair and grey eyes",31 unmodified lineswith gr.Row():sampler = gr.Dropdown(value="DPM++ S", show_label=True, label="Sampling Method:", 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"])with gr.Row():steps = gr.Slider(show_label=True, label="Sampling Steps:", minimum=1, maximum=50, value=35, step=1)with gr.Row():4 unmodified lineswidth = gr.Slider(label="Width", minimum=512, maximum=2048, step=8, value=896, interactive=True,)with gr.Row():height = gr.Slider(label="Height", minimum=512, maximum=2048, step=8, value=1152,interactive=True,)with gr.Column(scale=3):text_button = gr.Button("Generate image", variant="primary", interactive=True, elem_id="generate")179 unmodified lines18018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423531 unmodified lines2672682692702712722732742752762772782792802814 unmodified lines286287288289290291292179 unmodified linesimg = Image.open(BytesIO(response2.content))return img#####style_list = [{"name": "2560 x 1440","prompt": "hyper-realistic 4K image of {prompt}. ultra-detailed, lifelike, high-resolution, sharp, vibrant colors, photorealistic","negative_prompt": "cartoonish, low resolution, blurry, simplistic, abstract, deformed, ugly",},{"name": "Photo","prompt": "cinematic photo {prompt}. 35mm photograph, film, bokeh, professional, 4k, highly detailed","negative_prompt": "drawing, painting, crayon, sketch, graphite, impressionist, noisy, blurry, soft, deformed, ugly",},{"name": "Cinematic","prompt": "cinematic still {prompt}. emotional, harmonious, vignette, highly detailed, high budget, bokeh, cinemascope, moody, epic, gorgeous, film grain, grainy","negative_prompt": "anime, cartoon, graphic, text, painting, crayon, graphite, abstract, glitch, deformed, mutated, ugly, disfigured",},{"name": "Anime","prompt": "anime artwork {prompt}. anime style, key visual, vibrant, studio anime, highly detailed","negative_prompt": "photo, deformed, black and white, realism, disfigured, low contrast",},{"name": "3D Model","prompt": "professional 3d model {prompt}. octane render, highly detailed, volumetric, dramatic lighting","negative_prompt": "ugly, deformed, noisy, low poly, blurry, painting",},{"name": "(No style)","prompt": "{prompt}","negative_prompt": "",},]styles = {k["name"]: (k["prompt"], k["negative_prompt"]) for k in style_list}STYLE_NAMES = list(styles.keys())DEFAULT_STYLE_NAME = "2560 x 1440"def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str, str]:p, n = styles.get(style_name, styles[DEFAULT_STYLE_NAME])if not negative:negative = ""return p.replace("{prompt}", positive), n + negativeexamples = ["a beautiful woman with blonde hair and blue eyes","a beautiful woman with brown hair and grey eyes",31 unmodified lineswith gr.Row():sampler = gr.Dropdown(value="DPM++ S", show_label=True, label="Sampling Method:", 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"])with gr.Row(visible=True):style_selection = gr.Radio(show_label=True,container=True,interactive=True,choices=STYLE_NAMES,value=DEFAULT_STYLE_NAME,label="Image Style",)with gr.Row():steps = gr.Slider(show_label=True, label="Sampling Steps:", minimum=1, maximum=50, value=35, step=1)with gr.Row():4 unmodified lineswidth = gr.Slider(label="Width", minimum=512, maximum=2048, step=8, value=896, interactive=True,)with gr.Row():height = gr.Slider(label="Height", minimum=512, maximum=2048, step=8, value=1152,interactive=True,)with gr.Column(scale=3):text_button = gr.Button("Generate image", variant="primary", interactive=True, elem_id="generate")
app.py+60