Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -103,16 +103,12 @@ def Piper1(_do):
|
|
103 |
|
104 |
@spaces.GPU(duration=40)
|
105 |
def Piper2(img,posi,neg):
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
return retu
|
113 |
-
except Exception as e:
|
114 |
-
print(e)
|
115 |
-
return None
|
116 |
|
117 |
@spaces.GPU(duration=40)
|
118 |
def tok(pipe,txt):
|
@@ -179,18 +175,12 @@ def infer(p):
|
|
179 |
print(posi)
|
180 |
output = Piper1(posi)
|
181 |
print(output)
|
182 |
-
|
183 |
-
return None
|
184 |
-
else:
|
185 |
-
output.images[0].save(name)
|
186 |
if neg == None:
|
187 |
return name
|
188 |
img = load_image(name).convert("RGB")
|
189 |
output2 = Piper2(img,posi,neg)
|
190 |
-
|
191 |
-
return None
|
192 |
-
else:
|
193 |
-
output2.images[0].save("_"+name)
|
194 |
return "_"+name
|
195 |
|
196 |
def run(p1,p2,*result):
|
@@ -240,7 +230,7 @@ if __name__ == "__main__":
|
|
240 |
|
241 |
global result
|
242 |
global pp1
|
243 |
-
|
244 |
|
245 |
result=[]
|
246 |
pp1=pipe_t2i()
|
|
|
103 |
|
104 |
@spaces.GPU(duration=40)
|
105 |
def Piper2(img,posi,neg):
|
106 |
+
retu = pp2(
|
107 |
+
prompt=posi,
|
108 |
+
negative_prompt=neg,
|
109 |
+
image=img
|
110 |
+
)
|
111 |
+
return retu
|
|
|
|
|
|
|
|
|
112 |
|
113 |
@spaces.GPU(duration=40)
|
114 |
def tok(pipe,txt):
|
|
|
175 |
print(posi)
|
176 |
output = Piper1(posi)
|
177 |
print(output)
|
178 |
+
output.images[0].save(name)
|
|
|
|
|
|
|
179 |
if neg == None:
|
180 |
return name
|
181 |
img = load_image(name).convert("RGB")
|
182 |
output2 = Piper2(img,posi,neg)
|
183 |
+
output2.images[0].save("_"+name)
|
|
|
|
|
|
|
184 |
return "_"+name
|
185 |
|
186 |
def run(p1,p2,*result):
|
|
|
230 |
|
231 |
global result
|
232 |
global pp1
|
233 |
+
global pp2
|
234 |
|
235 |
result=[]
|
236 |
pp1=pipe_t2i()
|