comdoleger commited on
Commit
a88c47f
1 Parent(s): 94ded9c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -15,7 +15,7 @@ from enum import Enum
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,9 +216,9 @@ def resize_to_fit(max_size, original_size):
216
 
217
  def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg, model_type, steps, control_strength):
218
 
219
- max_size = (1500,1500)
220
  if prompt in prompt_list:
221
- max_size = (1500,1500)
222
  if isrmbg:
223
  try:
224
  rmbgfore = rmbg(fore)
@@ -233,12 +233,12 @@ def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg, model_typ
233
  image_width = size[0]
234
  image_height = size[1]
235
 
236
- if size[0]*size[1]<=(768*768):
237
  gr.Warning("ℹ️ The input image resolution is low, it might lead to some deformation!")
238
 
239
  if size[0]*size[1]>(max_size[0]*max_size[1]):
240
  gr.Warning("ℹ️ The input image size is too big, I will lower it!")
241
- image_width, image_height = resize_to_fit((1500,1500), (image_width, image_height))
242
  fore.resize(max_size)
243
 
244
 
@@ -250,17 +250,17 @@ def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg, model_typ
250
  "prompt" : prompt,
251
  "mode" : mode,
252
  "intensity" : float(intensity),
253
- "width" : 1500,
254
- "height" : 1500,
255
  "refprompt" : refprompt,
256
  "first_stage_steps" : int(steps),
257
  "first_stage_strength" : float(control_strength),
258
- "second_stage_steps" : 30
259
  }
260
 
261
  # Select the endpoint based on the model type
262
  if model_type == "anime":
263
- api_endpoint = api #to change to api_anime
264
  elif model_type == "realistic":
265
  api_endpoint = api
266
  else:
 
15
 
16
  api_key = os.getenv("FAI_API_KEY")
17
  api = os.getenv("FAI_API")
18
+ api_anime = os.getenv("FAI_API_2") #api_anime = os.getenv("ANIME_API")
19
  rmbgkey = os.getenv("RMBGKEY")
20
 
21
  #fore, prompt, intensity, mode, refprompt, isrmbg
 
216
 
217
  def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg, model_type, steps, control_strength):
218
 
219
+ max_size = (768,768)
220
  if prompt in prompt_list:
221
+ max_size = (768,768)
222
  if isrmbg:
223
  try:
224
  rmbgfore = rmbg(fore)
 
233
  image_width = size[0]
234
  image_height = size[1]
235
 
236
+ if size[0]*size[1]<=(512*512):
237
  gr.Warning("ℹ️ The input image resolution is low, it might lead to some deformation!")
238
 
239
  if size[0]*size[1]>(max_size[0]*max_size[1]):
240
  gr.Warning("ℹ️ The input image size is too big, I will lower it!")
241
+ image_width, image_height = resize_to_fit((768,768), (image_width, image_height))
242
  fore.resize(max_size)
243
 
244
 
 
250
  "prompt" : prompt,
251
  "mode" : mode,
252
  "intensity" : float(intensity),
253
+ "width" : 1000,
254
+ "height" : 1000,
255
  "refprompt" : refprompt,
256
  "first_stage_steps" : int(steps),
257
  "first_stage_strength" : float(control_strength),
258
+ "second_stage_steps" : 20
259
  }
260
 
261
  # Select the endpoint based on the model type
262
  if model_type == "anime":
263
+ api_endpoint = api_anime #to change to api_anime
264
  elif model_type == "realistic":
265
  api_endpoint = api
266
  else: