Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -58,14 +58,14 @@ def generate_random_string(length):
|
|
58 |
characters = string.ascii_letters + string.digits
|
59 |
return ''.join(random.choice(characters) for _ in range(length))
|
60 |
|
61 |
-
@spaces.GPU
|
62 |
def Piper(_do, _dont):
|
63 |
return pipe(
|
64 |
_do,
|
65 |
-
height=
|
66 |
-
width=
|
67 |
negative_prompt=_dont,
|
68 |
-
num_inference_steps=
|
69 |
guidance_scale=10
|
70 |
)
|
71 |
|
@@ -89,10 +89,12 @@ def infer(prompt1,prompt2,prompt3,prompt4):
|
|
89 |
if prompt4 == None:
|
90 |
prompt4 = "none"
|
91 |
else:
|
92 |
-
prompt4 = "
|
93 |
|
94 |
_do = f'Show an authentic {prompt3} scene, while focusing on the details, of {prompt1}, as the main elements, and, showing {prompt2} in the background.'
|
95 |
_dont = f'ANY usage of {prompt4}...'
|
|
|
|
|
96 |
image = Piper(_do, _dont).images[0].save(name)
|
97 |
return name
|
98 |
|
|
|
58 |
characters = string.ascii_letters + string.digits
|
59 |
return ''.join(random.choice(characters) for _ in range(length))
|
60 |
|
61 |
+
@spaces.GPU(120)
|
62 |
def Piper(_do, _dont):
|
63 |
return pipe(
|
64 |
_do,
|
65 |
+
height=448,
|
66 |
+
width=448,
|
67 |
negative_prompt=_dont,
|
68 |
+
num_inference_steps=400,
|
69 |
guidance_scale=10
|
70 |
)
|
71 |
|
|
|
89 |
if prompt4 == None:
|
90 |
prompt4 = "none"
|
91 |
else:
|
92 |
+
prompt4 = " and ".join([translate(v,"english").upper() for v in prompt4])
|
93 |
|
94 |
_do = f'Show an authentic {prompt3} scene, while focusing on the details, of {prompt1}, as the main elements, and, showing {prompt2} in the background.'
|
95 |
_dont = f'ANY usage of {prompt4}...'
|
96 |
+
print(_do)
|
97 |
+
print(_dont)
|
98 |
image = Piper(_do, _dont).images[0].save(name)
|
99 |
return name
|
100 |
|