salso commited on
Commit
ecbb850
·
verified ·
1 Parent(s): 9d28b96

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
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")
 
18
  rmbgkey = os.getenv("RMBGKEY")
19
 
20
  #fore, prompt, intensity, mode, refprompt, isrmbg
@@ -215,7 +216,7 @@ def resize_to_fit(max_size, original_size):
215
  return new_width, new_height
216
 
217
 
218
- def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg):
219
 
220
  max_size = (1500,1500)
221
  if prompt in prompt_list:
@@ -255,6 +256,14 @@ def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg):
255
  "height" : 1500,
256
  "refprompt" : refprompt
257
  }
 
 
 
 
 
 
 
 
258
  #print(f"DATA: {data}")
259
 
260
  '''
@@ -268,7 +277,7 @@ def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg):
268
  "refprompt" : " transparent glass "
269
  }
270
  '''
271
- image = process(data, api, api_key)
272
 
273
  return image
274
 
 
15
 
16
  api_key = os.getenv("FAI_API_KEY")
17
  api = os.getenv("FAI_API")
18
+ api_anime = os.getenv("ANIME_API")
19
  rmbgkey = os.getenv("RMBGKEY")
20
 
21
  #fore, prompt, intensity, mode, refprompt, isrmbg
 
216
  return new_width, new_height
217
 
218
 
219
+ def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg, model_type):
220
 
221
  max_size = (1500,1500)
222
  if prompt in prompt_list:
 
256
  "height" : 1500,
257
  "refprompt" : refprompt
258
  }
259
+
260
+ # Select the endpoint based on the model type
261
+ if model_type == "anime":
262
+ api_endpoint = api_anime
263
+ elif model_type == "realistic":
264
+ api_endpoint = api
265
+ else:
266
+ raise ValueError("Invalid model type selected.")
267
  #print(f"DATA: {data}")
268
 
269
  '''
 
277
  "refprompt" : " transparent glass "
278
  }
279
  '''
280
+ image = process(data, api_endpoint, api_key)
281
 
282
  return image
283