Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
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=
|
75 |
def Piper(_do,_dont):
|
76 |
return pipe(
|
77 |
_do,
|
78 |
height=512,
|
79 |
width=768,
|
80 |
negative_prompt=_dont,
|
81 |
-
num_inference_steps=
|
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'{
|
91 |
if prompt2 == None or prompt2.strip() == "":
|
92 |
-
_dont = 'ugly, deformed, disfigured, poor details, bad anatomy,
|
93 |
else:
|
94 |
-
_dont = f'ugly, deformed, disfigured, poor details, bad anatomy,
|
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 |
|