comdoleger commited on
Commit
29493a6
1 Parent(s): 37d1e64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -15,6 +15,7 @@ from enum import Enum
15
 
16
  api_key = os.getenv("FAI_API_KEY")
17
  api = os.getenv("FAI_API_5")
 
18
  api_anime = os.getenv("FAI_anime") #api_anime = os.getenv("ANIME_API")
19
  rmbgkey = os.getenv("RMBGKEY")
20
 
@@ -299,8 +300,20 @@ def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg, model_typ
299
  # Select the endpoint based on the model type
300
  if model_type == "anime":
301
  api_endpoint = api_anime #to change to api_anime
 
302
  elif model_type == "realistic":
303
  api_endpoint = api
 
 
 
 
 
 
 
 
 
 
 
304
  else:
305
  raise ValueError("Invalid model type selected.")
306
  #print(f"DATA: {data}")
@@ -316,7 +329,7 @@ def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg, model_typ
316
  "refprompt" : " transparent glass "
317
  }
318
  '''
319
- image = process(data, api_endpoint, api_key)
320
 
321
  return image
322
 
 
15
 
16
  api_key = os.getenv("FAI_API_KEY")
17
  api = os.getenv("FAI_API_5")
18
+ api_old = os.getenv("FAI_API_old")
19
  api_anime = os.getenv("FAI_anime") #api_anime = os.getenv("ANIME_API")
20
  rmbgkey = os.getenv("RMBGKEY")
21
 
 
300
  # Select the endpoint based on the model type
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}")
 
329
  "refprompt" : " transparent glass "
330
  }
331
  '''
332
+
333
 
334
  return image
335