alfredplpl commited on
Commit
47f4d74
1 Parent(s): fb9fddf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -38,8 +38,7 @@ def inference(prompt, guidance, steps, image_size="Square", seed=0, img=None, st
38
 
39
  generator = torch.Generator('cuda').manual_seed(seed) if seed != 0 else None
40
 
41
- if(not disable_auto_prompt_correction):
42
- prompt,neg_prompt=auto_prompt_correction(prompt,neg_prompt,cool_japan_type)
43
 
44
  if(image_size=="Portrait"):
45
  height=768
@@ -60,7 +59,7 @@ def inference(prompt, guidance, steps, image_size="Square", seed=0, img=None, st
60
  return txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator), None
61
  except Exception as e:
62
  return None, error_str(e)
63
- def auto_prompt_correction(prompt_ui,neg_prompt_ui,cool_japan_type_ui):
64
  # auto prompt correction
65
  cool_japan_type=str(cool_japan_type_ui)
66
  if(cool_japan_type=="Manga"):
@@ -74,6 +73,10 @@ def auto_prompt_correction(prompt_ui,neg_prompt_ui,cool_japan_type_ui):
74
  neg_prompt=str(neg_prompt_ui)
75
  prompt=prompt.lower()
76
  neg_prompt=neg_prompt.lower()
 
 
 
 
77
  if(prompt=="" and neg_prompt==""):
78
  #prefix=["masterpiece","evangelion, mika pikazo", "konosuba, mika pikazo","steins; gate, ilya kuvshinov",
79
  # "ghibli, shinkai makoto", "evangelion, madoka magica"]
 
38
 
39
  generator = torch.Generator('cuda').manual_seed(seed) if seed != 0 else None
40
 
41
+ prompt,neg_prompt=auto_prompt_correction(prompt,neg_prompt,cool_japan_type,disable_auto_prompt_correction)
 
42
 
43
  if(image_size=="Portrait"):
44
  height=768
 
59
  return txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator), None
60
  except Exception as e:
61
  return None, error_str(e)
62
+ def auto_prompt_correction(prompt_ui,neg_prompt_ui,cool_japan_type_ui,disable_auto_prompt_correction):
63
  # auto prompt correction
64
  cool_japan_type=str(cool_japan_type_ui)
65
  if(cool_japan_type=="Manga"):
 
73
  neg_prompt=str(neg_prompt_ui)
74
  prompt=prompt.lower()
75
  neg_prompt=neg_prompt.lower()
76
+ if(disable_auto_prompt_correction):
77
+ prompt=f"{cool_japan_type}, {prompt}"
78
+ return prompt, neg_prompt
79
+
80
  if(prompt=="" and neg_prompt==""):
81
  #prefix=["masterpiece","evangelion, mika pikazo", "konosuba, mika pikazo","steins; gate, ilya kuvshinov",
82
  # "ghibli, shinkai makoto", "evangelion, madoka magica"]