salomonsky commited on
Commit
471c590
1 Parent(s): 20de417

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -14,6 +14,7 @@ from gradio_imageslider import ImageSlider
14
 
15
  translator = Translator()
16
  HF_TOKEN = os.environ.get("HF_TOKEN")
 
17
  MAX_SEED = np.iinfo(np.int32).max
18
  CSS = "footer { visibility: hidden; }"
19
  JS = "function () { gradioURL = window.location.href; if (!gradioURL.endsWith('?__theme=dark')) { window.location.replace(gradioURL + '?__theme=dark'); } }"
@@ -47,7 +48,7 @@ async def gen(prompt, basemodel, lora_add, lora_word, width, height, scales, ste
47
  return [image_path, upscale_image]
48
 
49
  def get_upscale_finegrain(prompt, img_path, upscale_factor):
50
- client = Client("finegrain/finegrain-image-enhancer")
51
  result = client.predict(input_image=handle_file(img_path), prompt=prompt, negative_prompt="", seed=42, upscale_factor=upscale_factor, controlnet_scale=0.6, controlnet_decay=1, condition_scale=6, tile_width=112, tile_height=144, denoise_strength=0.35, num_inference_steps=18, solver="DDIM", api_name="/process")
52
  return result[1]
53
 
 
14
 
15
  translator = Translator()
16
  HF_TOKEN = os.environ.get("HF_TOKEN")
17
+ HF_TOKEN_UPSCALER = os.environ.get("HF_TOKEN_UPSCALER")
18
  MAX_SEED = np.iinfo(np.int32).max
19
  CSS = "footer { visibility: hidden; }"
20
  JS = "function () { gradioURL = window.location.href; if (!gradioURL.endsWith('?__theme=dark')) { window.location.replace(gradioURL + '?__theme=dark'); } }"
 
48
  return [image_path, upscale_image]
49
 
50
  def get_upscale_finegrain(prompt, img_path, upscale_factor):
51
+ client = Client("finegrain/finegrain-image-enhancer", hf_token=HF_TOKEN_UPSCALER)
52
  result = client.predict(input_image=handle_file(img_path), prompt=prompt, negative_prompt="", seed=42, upscale_factor=upscale_factor, controlnet_scale=0.6, controlnet_decay=1, condition_scale=6, tile_width=112, tile_height=144, denoise_strength=0.35, num_inference_steps=18, solver="DDIM", api_name="/process")
53
  return result[1]
54