Update app.py
Browse files
app.py
CHANGED
|
@@ -29,6 +29,62 @@ pipe.to(device)
|
|
| 29 |
MAX_SEED = np.iinfo(np.int32).max
|
| 30 |
MAX_IMAGE_SIZE = 4096
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
@spaces.GPU #[uncomment to use ZeroGPU]
|
| 34 |
def infer(
|
|
@@ -75,7 +131,7 @@ css = """
|
|
| 75 |
|
| 76 |
with gr.Blocks(css=css) as demo:
|
| 77 |
with gr.Column(elem_id="col-container"):
|
| 78 |
-
gr.Markdown(" #
|
| 79 |
|
| 80 |
with gr.Row():
|
| 81 |
prompt = gr.Text(
|
|
@@ -90,6 +146,16 @@ with gr.Blocks(css=css) as demo:
|
|
| 90 |
|
| 91 |
result = gr.Image(label="Result", show_label=False)
|
| 92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
with gr.Accordion("Advanced Settings", open=False):
|
| 94 |
negative_prompt = gr.Text(
|
| 95 |
label="Negative prompt",
|
|
|
|
| 29 |
MAX_SEED = np.iinfo(np.int32).max
|
| 30 |
MAX_IMAGE_SIZE = 4096
|
| 31 |
|
| 32 |
+
style_list = [
|
| 33 |
+
{
|
| 34 |
+
"name": "(No style)",
|
| 35 |
+
"prompt": "{prompt}",
|
| 36 |
+
"negative_prompt": "",
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"name": "Cinematic",
|
| 40 |
+
"prompt": "cinematic still {prompt} . emotional, harmonious, vignette, highly detailed, high budget, bokeh, cinemascope, moody, epic, gorgeous, film grain, grainy",
|
| 41 |
+
"negative_prompt": "anime, cartoon, graphic, text, painting, crayon, graphite, abstract, glitch, deformed, mutated, ugly, disfigured",
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"name": "Photographic",
|
| 45 |
+
"prompt": "cinematic photo {prompt} . 35mm photograph, film, bokeh, professional, 4k, highly detailed",
|
| 46 |
+
"negative_prompt": "drawing, painting, crayon, sketch, graphite, impressionist, noisy, blurry, soft, deformed, ugly",
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"name": "Anime",
|
| 50 |
+
"prompt": "anime artwork {prompt} . anime style, key visual, vibrant, studio anime, highly detailed",
|
| 51 |
+
"negative_prompt": "photo, deformed, black and white, realism, disfigured, low contrast",
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"name": "Manga",
|
| 55 |
+
"prompt": "manga style {prompt} . vibrant, high-energy, detailed, iconic, Japanese comic style",
|
| 56 |
+
"negative_prompt": "ugly, deformed, noisy, blurry, low contrast, realism, photorealistic, Western comic style",
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"name": "Digital Art",
|
| 60 |
+
"prompt": "concept art {prompt} . digital artwork, illustrative, painterly, matte painting, highly detailed",
|
| 61 |
+
"negative_prompt": "photo, photorealistic, realism, ugly",
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"name": "Pixel art",
|
| 65 |
+
"prompt": "pixel-art {prompt} . low-res, blocky, pixel art style, 8-bit graphics",
|
| 66 |
+
"negative_prompt": "sloppy, messy, blurry, noisy, highly detailed, ultra textured, photo, realistic",
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"name": "Fantasy art",
|
| 70 |
+
"prompt": "ethereal fantasy concept art of {prompt} . magnificent, celestial, ethereal, painterly, epic, majestic, magical, fantasy art, cover art, dreamy",
|
| 71 |
+
"negative_prompt": "photographic, realistic, realism, 35mm film, dslr, cropped, frame, text, deformed, glitch, noise, noisy, off-center, deformed, cross-eyed, closed eyes, bad anatomy, ugly, disfigured, sloppy, duplicate, mutated, black and white",
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"name": "Neonpunk",
|
| 75 |
+
"prompt": "neonpunk style {prompt} . cyberpunk, vaporwave, neon, vibes, vibrant, stunningly beautiful, crisp, detailed, sleek, ultramodern, magenta highlights, dark purple shadows, high contrast, cinematic, ultra detailed, intricate, professional",
|
| 76 |
+
"negative_prompt": "painting, drawing, illustration, glitch, deformed, mutated, cross-eyed, ugly, disfigured",
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"name": "3D Model",
|
| 80 |
+
"prompt": "professional 3d model {prompt} . octane render, highly detailed, volumetric, dramatic lighting",
|
| 81 |
+
"negative_prompt": "ugly, deformed, noisy, low poly, blurry, painting",
|
| 82 |
+
},
|
| 83 |
+
]
|
| 84 |
+
|
| 85 |
+
styles = {k["name"]: (k["prompt"], k["negative_prompt"]) for k in style_list}
|
| 86 |
+
STYLE_NAMES = list(styles.keys())
|
| 87 |
+
DEFAULT_STYLE_NAME = "(No style)"
|
| 88 |
|
| 89 |
@spaces.GPU #[uncomment to use ZeroGPU]
|
| 90 |
def infer(
|
|
|
|
| 131 |
|
| 132 |
with gr.Blocks(css=css) as demo:
|
| 133 |
with gr.Column(elem_id="col-container"):
|
| 134 |
+
gr.Markdown(" # ImageGen, the fastest and most precise image generator")
|
| 135 |
|
| 136 |
with gr.Row():
|
| 137 |
prompt = gr.Text(
|
|
|
|
| 146 |
|
| 147 |
result = gr.Image(label="Result", show_label=False)
|
| 148 |
|
| 149 |
+
with gr.Row(visible=True):
|
| 150 |
+
style_selection = gr.Radio(
|
| 151 |
+
show_label=True,
|
| 152 |
+
container=True,
|
| 153 |
+
interactive=True,
|
| 154 |
+
choices=STYLE_NAMES,
|
| 155 |
+
value=DEFAULT_STYLE_NAME,
|
| 156 |
+
label="Image Style",
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
with gr.Accordion("Advanced Settings", open=False):
|
| 160 |
negative_prompt = gr.Text(
|
| 161 |
label="Negative prompt",
|