valhalla commited on
Commit
58672d9
1 Parent(s): 6459f85

Update app_sketch.py

Browse files
Files changed (1) hide show
  1. app_sketch.py +2 -47
app_sketch.py CHANGED
@@ -6,57 +6,12 @@ import torch
6
  import torchvision.transforms.functional as TF
7
 
8
  from model import Model
9
- from utils import MAX_SEED, randomize_seed_fn
10
 
11
- SKETCH_ADAPTER_NAME = "TencentARC/t2i-adapter-sketch-sdxl-1.0"
12
 
13
- style_list = [
14
- {
15
- "name": "Cinematic",
16
- "prompt": "cinematic still {prompt} . emotional, harmonious, vignette, highly detailed, high budget, bokeh, cinemascope, moody, epic, gorgeous, film grain, grainy",
17
- "negative_prompt": "anime, cartoon, graphic, text, painting, crayon, graphite, abstract, glitch, deformed, mutated, ugly, disfigured",
18
- },
19
- {
20
- "name": "3D Model",
21
- "prompt": "professional 3d model {prompt} . octane render, highly detailed, volumetric, dramatic lighting",
22
- "negative_prompt": "ugly, deformed, noisy, low poly, blurry, painting",
23
- },
24
- {
25
- "name": "Anime",
26
- "prompt": "anime artwork {prompt} . anime style, key visual, vibrant, studio anime, highly detailed",
27
- "negative_prompt": "photo, deformed, black and white, realism, disfigured, low contrast",
28
- },
29
- {
30
- "name": "Digital Art",
31
- "prompt": "concept art {prompt} . digital artwork, illustrative, painterly, matte painting, highly detailed",
32
- "negative_prompt": "photo, photorealistic, realism, ugly",
33
- },
34
- {
35
- "name": "Photographic",
36
- "prompt": "cinematic photo {prompt} . 35mm photograph, film, bokeh, professional, 4k, highly detailed",
37
- "negative_prompt": "drawing, painting, crayon, sketch, graphite, impressionist, noisy, blurry, soft, deformed, ugly",
38
- },
39
- {
40
- "name": "Pixel art",
41
- "prompt": "pixel-art {prompt} . low-res, blocky, pixel art style, 8-bit graphics",
42
- "negative_prompt": "sloppy, messy, blurry, noisy, highly detailed, ultra textured, photo, realistic",
43
- },
44
- {
45
- "name": "Fantasy art",
46
- "prompt": "ethereal fantasy concept art of {prompt} . magnificent, celestial, ethereal, painterly, epic, majestic, magical, fantasy art, cover art, dreamy",
47
- "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",
48
- },
49
- ]
50
 
51
- styles = {k["name"]: (k["prompt"], k["negative_prompt"]) for k in style_list}
52
  default_style_name = "Photographic"
53
- default_style = styles[default_style_name]
54
- style_names = list(styles.keys())
55
-
56
-
57
- def apply_style(style_name: str, positive: str, negative: str = "") -> tuple[str, str]:
58
- p, n = styles.get(style_name, default_style)
59
- return p.replace("{prompt}", positive), n + negative
60
 
61
 
62
  def create_demo(model: Model) -> gr.Blocks:
 
6
  import torchvision.transforms.functional as TF
7
 
8
  from model import Model
9
+ from utils import MAX_SEED, randomize_seed_fn, styles, style_names, apply_style
10
 
 
11
 
12
+ SKETCH_ADAPTER_NAME = "TencentARC/t2i-adapter-sketch-sdxl-1.0"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
 
14
  default_style_name = "Photographic"
 
 
 
 
 
 
 
15
 
16
 
17
  def create_demo(model: Model) -> gr.Blocks: