Spaces:
Running
Running
comdoleger
commited on
Commit
•
d831228
1
Parent(s):
29493a6
Update app.py
Browse files
app.py
CHANGED
@@ -266,7 +266,17 @@ def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg, model_typ
|
|
266 |
except:
|
267 |
pass
|
268 |
|
269 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
size = fore.size
|
271 |
image_width = size[0]
|
272 |
image_height = size[1]
|
@@ -297,25 +307,7 @@ def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg, model_typ
|
|
297 |
"second_stage_steps" : 20
|
298 |
}
|
299 |
|
300 |
-
|
301 |
-
if model_type == "anime":
|
302 |
-
api_endpoint = api_anime #to change to api_anime
|
303 |
-
image = process(data, api_endpoint, api_key)
|
304 |
-
elif model_type == "realistic":
|
305 |
-
api_endpoint = api
|
306 |
-
if data['mode']=="full":
|
307 |
-
data['mode']="first-stage"
|
308 |
-
image = process(data, api_endpoint, api_key)
|
309 |
-
forestr = image_to_base64(image.convert("RGBA"))
|
310 |
-
data['foreground_image64']=forestr
|
311 |
-
data['mode']="refiner"
|
312 |
-
api_endpoint = api_old
|
313 |
-
image = process(data, api_endpoint, api_key)
|
314 |
-
elif data['mode']=="refiner":
|
315 |
-
api_endpoint = api_old
|
316 |
-
image = process(data, api_endpoint, api_key)
|
317 |
-
else:
|
318 |
-
raise ValueError("Invalid model type selected.")
|
319 |
#print(f"DATA: {data}")
|
320 |
|
321 |
'''
|
@@ -329,7 +321,7 @@ def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg, model_typ
|
|
329 |
"refprompt" : " transparent glass "
|
330 |
}
|
331 |
'''
|
332 |
-
|
333 |
|
334 |
return image
|
335 |
|
|
|
266 |
except:
|
267 |
pass
|
268 |
|
269 |
+
#
|
270 |
+
# Select the endpoint based on the model type
|
271 |
+
if model_type == "anime":
|
272 |
+
api_endpoint = api_anime #to change to api_anime
|
273 |
+
|
274 |
+
elif model_type == "realistic":
|
275 |
+
fore = create_square_image(fore)
|
276 |
+
api_endpoint = api_old
|
277 |
+
|
278 |
+
else:
|
279 |
+
raise ValueError("Invalid model type selected.")
|
280 |
size = fore.size
|
281 |
image_width = size[0]
|
282 |
image_height = size[1]
|
|
|
307 |
"second_stage_steps" : 20
|
308 |
}
|
309 |
|
310 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
#print(f"DATA: {data}")
|
312 |
|
313 |
'''
|
|
|
321 |
"refprompt" : " transparent glass "
|
322 |
}
|
323 |
'''
|
324 |
+
image = process(data, api_endpoint, api_key)
|
325 |
|
326 |
return image
|
327 |
|