Spaces:
Running
Running
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -88,7 +88,7 @@ def generate_random_string(length):
|
|
88 |
return ''.join(random.choice(characters) for _ in range(length))
|
89 |
|
90 |
@spaces.GPU(duration=40)
|
91 |
-
def Piper1(
|
92 |
try:
|
93 |
retu = pp1(
|
94 |
_do,
|
@@ -104,7 +104,7 @@ def Piper1(pipe,_do):
|
|
104 |
return None
|
105 |
|
106 |
@spaces.GPU(duration=40)
|
107 |
-
def Piper2(
|
108 |
try:
|
109 |
retu = pp2(
|
110 |
prompt=posi,
|
@@ -164,8 +164,11 @@ function custom(){
|
|
164 |
def infer(p):
|
165 |
print("infer: started")
|
166 |
p1 = p["a"]
|
|
|
167 |
p2 = p["b"]
|
|
|
168 |
name = generate_random_string(12)+".png"
|
|
|
169 |
_do = ['beautiful', 'playful', 'photographed', 'realistic', 'dynamic poze', 'deep field', 'reasonable coloring', 'rough texture', 'best quality', 'focused']
|
170 |
if p1 != "":
|
171 |
_do.append(f'{p1}')
|
@@ -174,7 +177,9 @@ def infer(p):
|
|
174 |
neg = _dont
|
175 |
else:
|
176 |
neg = None
|
177 |
-
|
|
|
|
|
178 |
if output == None:
|
179 |
return None
|
180 |
else:
|
|
|
88 |
return ''.join(random.choice(characters) for _ in range(length))
|
89 |
|
90 |
@spaces.GPU(duration=40)
|
91 |
+
def Piper1(_do):
|
92 |
try:
|
93 |
retu = pp1(
|
94 |
_do,
|
|
|
104 |
return None
|
105 |
|
106 |
@spaces.GPU(duration=40)
|
107 |
+
def Piper2(img,posi,neg):
|
108 |
try:
|
109 |
retu = pp2(
|
110 |
prompt=posi,
|
|
|
164 |
def infer(p):
|
165 |
print("infer: started")
|
166 |
p1 = p["a"]
|
167 |
+
print(f'prompt 1: {p1}')
|
168 |
p2 = p["b"]
|
169 |
+
print(f'prompt 2: {p2}')
|
170 |
name = generate_random_string(12)+".png"
|
171 |
+
print(f'name: {name}')
|
172 |
_do = ['beautiful', 'playful', 'photographed', 'realistic', 'dynamic poze', 'deep field', 'reasonable coloring', 'rough texture', 'best quality', 'focused']
|
173 |
if p1 != "":
|
174 |
_do.append(f'{p1}')
|
|
|
177 |
neg = _dont
|
178 |
else:
|
179 |
neg = None
|
180 |
+
posi = " ".join(_do)
|
181 |
+
print(posi, neg)
|
182 |
+
output = Piper1(posi)
|
183 |
if output == None:
|
184 |
return None
|
185 |
else:
|