Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -83,27 +83,27 @@ def generate_random_string(length):
|
|
83 |
characters = string.ascii_letters + string.digits
|
84 |
return ''.join(random.choice(characters) for _ in range(length))
|
85 |
|
86 |
-
@spaces.GPU(duration=
|
87 |
def Piper(_do,_dont):
|
88 |
return pipe(
|
89 |
_do,
|
90 |
height=320,
|
91 |
width=640,
|
92 |
negative_prompt=_dont,
|
93 |
-
num_inference_steps=
|
94 |
-
guidance_scale=
|
95 |
)
|
96 |
|
97 |
def infer(prompt_en,prompt2_en):
|
98 |
name = generate_random_string(12)+".png"
|
99 |
if prompt_en == "":
|
100 |
-
_do = '
|
101 |
else:
|
102 |
-
_do = f'photographed { prompt_en }
|
103 |
if prompt2_en == "":
|
104 |
-
_dont = '
|
105 |
else:
|
106 |
-
_dont = f'{prompt2_en} where in {prompt_en},
|
107 |
image = Piper(_do,_dont).images[0].save(name)
|
108 |
return name
|
109 |
|
|
|
83 |
characters = string.ascii_letters + string.digits
|
84 |
return ''.join(random.choice(characters) for _ in range(length))
|
85 |
|
86 |
+
@spaces.GPU(duration=40)
|
87 |
def Piper(_do,_dont):
|
88 |
return pipe(
|
89 |
_do,
|
90 |
height=320,
|
91 |
width=640,
|
92 |
negative_prompt=_dont,
|
93 |
+
num_inference_steps=100,
|
94 |
+
guidance_scale=4
|
95 |
)
|
96 |
|
97 |
def infer(prompt_en,prompt2_en):
|
98 |
name = generate_random_string(12)+".png"
|
99 |
if prompt_en == "":
|
100 |
+
_do = 'photographed reasonable situation'
|
101 |
else:
|
102 |
+
_do = f'photographed { prompt_en } reasonable situation'
|
103 |
if prompt2_en == "":
|
104 |
+
_dont = 'unformed, unproportional, boring, smooth, fictional, blurred, twisted, distorted, divined, body defects, damaged structure, signs, prints'
|
105 |
else:
|
106 |
+
_dont = f'{prompt2_en} where in {prompt_en}, unformed, unproportional, boring, smooth, fictional, blurred, twisted, distorted, divined, body defects, damaged structure, signs, prints'
|
107 |
image = Piper(_do,_dont).images[0].save(name)
|
108 |
return name
|
109 |
|