DigiP-AI commited on
Commit
3d6c3e2
·
verified ·
1 Parent(s): 3f70fff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +60 -0
app.py CHANGED
@@ -180,6 +180,56 @@ def mirror(image_output, scale_by, method, gfpgan, codeformer):
180
  img = Image.open(BytesIO(response2.content))
181
  return img
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  examples = [
184
  "a beautiful woman with blonde hair and blue eyes",
185
  "a beautiful woman with brown hair and grey eyes",
@@ -217,6 +267,15 @@ with gr.Blocks(css=css, theme=theme, fill_width= False) as app:
217
  with gr.Row():
218
  sampler = gr.Dropdown(value="DPM++ S", show_label=True, label="Sampling Method:", choices=[
219
  "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"])
 
 
 
 
 
 
 
 
 
220
  with gr.Row():
221
  steps = gr.Slider(show_label=True, label="Sampling Steps:", minimum=1, maximum=50, value=35, step=1)
222
  with gr.Row():
@@ -227,6 +286,7 @@ with gr.Blocks(css=css, theme=theme, fill_width= False) as app:
227
  width = gr.Slider(label="Width", minimum=512, maximum=2048, step=8, value=896, interactive=True,)
228
  with gr.Row():
229
  height = gr.Slider(label="Height", minimum=512, maximum=2048, step=8, value=1152,interactive=True,)
 
230
 
231
  with gr.Column(scale=3):
232
  text_button = gr.Button("Generate image", variant="primary", interactive=True, elem_id="generate")
 
180
  img = Image.open(BytesIO(response2.content))
181
  return img
182
 
183
+ #####
184
+
185
+ style_list = [
186
+
187
+ {
188
+ "name": "2560 x 1440",
189
+ "prompt": "hyper-realistic 4K image of {prompt}. ultra-detailed, lifelike, high-resolution, sharp, vibrant colors, photorealistic",
190
+ "negative_prompt": "cartoonish, low resolution, blurry, simplistic, abstract, deformed, ugly",
191
+ },
192
+
193
+ {
194
+ "name": "Photo",
195
+ "prompt": "cinematic photo {prompt}. 35mm photograph, film, bokeh, professional, 4k, highly detailed",
196
+ "negative_prompt": "drawing, painting, crayon, sketch, graphite, impressionist, noisy, blurry, soft, deformed, ugly",
197
+ },
198
+
199
+ {
200
+ "name": "Cinematic",
201
+ "prompt": "cinematic still {prompt}. emotional, harmonious, vignette, highly detailed, high budget, bokeh, cinemascope, moody, epic, gorgeous, film grain, grainy",
202
+ "negative_prompt": "anime, cartoon, graphic, text, painting, crayon, graphite, abstract, glitch, deformed, mutated, ugly, disfigured",
203
+ },
204
+
205
+ {
206
+ "name": "Anime",
207
+ "prompt": "anime artwork {prompt}. anime style, key visual, vibrant, studio anime, highly detailed",
208
+ "negative_prompt": "photo, deformed, black and white, realism, disfigured, low contrast",
209
+ },
210
+ {
211
+ "name": "3D Model",
212
+ "prompt": "professional 3d model {prompt}. octane render, highly detailed, volumetric, dramatic lighting",
213
+ "negative_prompt": "ugly, deformed, noisy, low poly, blurry, painting",
214
+ },
215
+ {
216
+ "name": "(No style)",
217
+ "prompt": "{prompt}",
218
+ "negative_prompt": "",
219
+ },
220
+ ]
221
+
222
+ styles = {k["name"]: (k["prompt"], k["negative_prompt"]) for k in style_list}
223
+ STYLE_NAMES = list(styles.keys())
224
+ DEFAULT_STYLE_NAME = "2560 x 1440"
225
+
226
+ def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str, str]:
227
+ p, n = styles.get(style_name, styles[DEFAULT_STYLE_NAME])
228
+ if not negative:
229
+ negative = ""
230
+ return p.replace("{prompt}", positive), n + negative
231
+
232
+
233
  examples = [
234
  "a beautiful woman with blonde hair and blue eyes",
235
  "a beautiful woman with brown hair and grey eyes",
 
267
  with gr.Row():
268
  sampler = gr.Dropdown(value="DPM++ S", show_label=True, label="Sampling Method:", choices=[
269
  "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"])
270
+ with gr.Row(visible=True):
271
+ style_selection = gr.Radio(
272
+ show_label=True,
273
+ container=True,
274
+ interactive=True,
275
+ choices=STYLE_NAMES,
276
+ value=DEFAULT_STYLE_NAME,
277
+ label="Image Style",
278
+ )
279
  with gr.Row():
280
  steps = gr.Slider(show_label=True, label="Sampling Steps:", minimum=1, maximum=50, value=35, step=1)
281
  with gr.Row():
 
286
  width = gr.Slider(label="Width", minimum=512, maximum=2048, step=8, value=896, interactive=True,)
287
  with gr.Row():
288
  height = gr.Slider(label="Height", minimum=512, maximum=2048, step=8, value=1152,interactive=True,)
289
+
290
 
291
  with gr.Column(scale=3):
292
  text_button = gr.Button("Generate image", variant="primary", interactive=True, elem_id="generate")