Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -76,7 +76,7 @@ def generate_random_string(length):
|
|
76 |
characters = string.ascii_letters + string.digits
|
77 |
return ''.join(random.choice(characters) for _ in range(length))
|
78 |
|
79 |
-
@spaces.GPU(duration=
|
80 |
def Piper(_do,neg):
|
81 |
try:
|
82 |
retu = pipe_flx(
|
@@ -84,7 +84,7 @@ def Piper(_do,neg):
|
|
84 |
neg_prompt_ids=neg,
|
85 |
height=512,
|
86 |
width=512,
|
87 |
-
num_inference_steps=
|
88 |
max_sequence_length=256,
|
89 |
guidance_scale=0
|
90 |
)
|
@@ -93,6 +93,12 @@ def Piper(_do,neg):
|
|
93 |
print(e)
|
94 |
return None
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
def infer(p1,p2):
|
97 |
name = generate_random_string(12)+".png"
|
98 |
_do = ['beautiful', 'playful', 'photographed', 'realistic', 'dynamic poze', 'deep field', 'reasonable coloring', 'rough texture', 'best quality', 'focused']
|
@@ -100,8 +106,7 @@ def infer(p1,p2):
|
|
100 |
_do.append(f'{p1}')
|
101 |
if p2 != "":
|
102 |
_dont = f'{p2} where in {p1}'
|
103 |
-
neg =
|
104 |
-
print(neg)
|
105 |
else:
|
106 |
neg = None
|
107 |
output = Piper('A '+" ".join(_do,neg),_dont)
|
|
|
76 |
characters = string.ascii_letters + string.digits
|
77 |
return ''.join(random.choice(characters) for _ in range(length))
|
78 |
|
79 |
+
@spaces.GPU(duration=35)
|
80 |
def Piper(_do,neg):
|
81 |
try:
|
82 |
retu = pipe_flx(
|
|
|
84 |
neg_prompt_ids=neg,
|
85 |
height=512,
|
86 |
width=512,
|
87 |
+
num_inference_steps=6,
|
88 |
max_sequence_length=256,
|
89 |
guidance_scale=0
|
90 |
)
|
|
|
93 |
print(e)
|
94 |
return None
|
95 |
|
96 |
+
@spaces.GPU(duration=25)
|
97 |
+
def negator():
|
98 |
+
neg = pipe.tokenizer(_dont)['input_ids']
|
99 |
+
print(neg)
|
100 |
+
return neg
|
101 |
+
|
102 |
def infer(p1,p2):
|
103 |
name = generate_random_string(12)+".png"
|
104 |
_do = ['beautiful', 'playful', 'photographed', 'realistic', 'dynamic poze', 'deep field', 'reasonable coloring', 'rough texture', 'best quality', 'focused']
|
|
|
106 |
_do.append(f'{p1}')
|
107 |
if p2 != "":
|
108 |
_dont = f'{p2} where in {p1}'
|
109 |
+
neg = negator(_dont)
|
|
|
110 |
else:
|
111 |
neg = None
|
112 |
output = Piper('A '+" ".join(_do,neg),_dont)
|