Yaron Koresh commited on
Commit
ae2310a
·
verified ·
1 Parent(s): 1356226

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -71,27 +71,29 @@ def generate_random_string(length):
71
  characters = string.ascii_letters + string.digits
72
  return ''.join(random.choice(characters) for _ in range(length))
73
 
74
- @spaces.GPU(duration=120)
75
  def Piper(_do,_dont):
76
  return pipe(
77
  _do,
78
  height=512,
79
  width=768,
80
  negative_prompt=_dont,
81
- num_inference_steps=100,
82
  guidance_scale=10
83
  )
84
 
85
  def infer(prompt,prompt2):
86
  name = generate_random_string(12)+".png"
 
 
87
  if prompt == None or prompt.strip() == "":
88
  _do = 'hot colors palette, muted colors, dynamic poze, realistic, accurate, matched, realistic details, award winning photograph, soft natural lighting, deep field, high definition, highly detailed, 8k'
89
  else:
90
- _do = f'{ translate(prompt,"english") }, hot colors palette, muted colors, dynamic poze, realistic, accurate, matched, realistic details, award winning photograph, soft natural lighting, deep field, high definition, highly detailed, 8k'
91
  if prompt2 == None or prompt2.strip() == "":
92
- _dont = 'ugly, deformed, disfigured, poor details, bad anatomy, visible label, visible text, visible logo'
93
  else:
94
- _dont = f'ugly, deformed, disfigured, poor details, bad anatomy, visible label, visible text, visible logo, visible {translate(prompt2,"english")}'
95
  image = Piper(_do,_dont).images[0].save(name)
96
  return name
97
 
 
71
  characters = string.ascii_letters + string.digits
72
  return ''.join(random.choice(characters) for _ in range(length))
73
 
74
+ @spaces.GPU(duration=30)
75
  def Piper(_do,_dont):
76
  return pipe(
77
  _do,
78
  height=512,
79
  width=768,
80
  negative_prompt=_dont,
81
+ num_inference_steps=40,
82
  guidance_scale=10
83
  )
84
 
85
  def infer(prompt,prompt2):
86
  name = generate_random_string(12)+".png"
87
+ prompt_en = translate(prompt,"english")
88
+ prompt2_en = translate(prompt2,"english")
89
  if prompt == None or prompt.strip() == "":
90
  _do = 'hot colors palette, muted colors, dynamic poze, realistic, accurate, matched, realistic details, award winning photograph, soft natural lighting, deep field, high definition, highly detailed, 8k'
91
  else:
92
+ _do = f'{ prompt_en }, hot colors palette, muted colors, dynamic poze, realistic, accurate, matched, realistic details, award winning photograph, soft natural lighting, deep field, high definition, highly detailed, 8k'
93
  if prompt2 == None or prompt2.strip() == "":
94
+ _dont = 'ugly, deformed, disfigured, poor details, bad anatomy, label, text, logo'
95
  else:
96
+ _dont = f'ugly, deformed, disfigured, poor details, bad anatomy, label, text, logo, {prompt_en} where including {prompt2_en}, {prompt2_en}'
97
  image = Piper(_do,_dont).images[0].save(name)
98
  return name
99