lichorosario commited on
Commit
9a4acf1
1 Parent(s): fcd261f

feat: Update app.py to use new Tile-Upscaler client

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -9,6 +9,8 @@ with open('loras.json', 'r') as f:
9
 
10
  job = None
11
 
 
 
12
  def infer(selected_index, prompt, style_prompt, inf_steps, guidance_scale, width, height, seed, lora_weight, progress=gr.Progress(track_tqdm=True)):
13
  try:
14
 
@@ -20,14 +22,12 @@ def infer(selected_index, prompt, style_prompt, inf_steps, guidance_scale, width
20
  custom_model = selected_lora["repo"]
21
  trigger_word = selected_lora["trigger_word"]
22
 
23
- client = Client("fffiloni/sd-xl-custom-model")
24
  result = client.submit(
25
  custom_model=custom_model,
26
  api_name="/load_model"
27
  )
28
  weight_name = result.result()[2]['value']
29
 
30
- client = Client("fffiloni/sd-xl-custom-model")
31
  prompt_arr = [trigger_word, prompt, style_prompt]
32
  prompt = '. '.join([element.strip() for element in prompt_arr if element.strip() != ''])
33
 
@@ -71,16 +71,16 @@ def update_selection(evt: gr.SelectData):
71
 
72
  def upscale(image, resolution, inf_steps, strength, hdr_effect, guidance_scale):
73
  try:
74
- other_client = Client("gokaygokay/Tile-Upscaler")
75
- result = other_client.predict(
76
- param_0=handle_file(image),
77
- param_1=resolution,
78
- param_2=inf_steps,
79
- param_3=strength,
80
- param_4=hdr_effect,
81
- param_5=guidance_scale,
82
- api_name="/wrapper"
83
- )
84
  return [image, image]
85
  return result
86
  except Exception as e:
 
9
 
10
  job = None
11
 
12
+ client = Client("fffiloni/sd-xl-custom-model")
13
+
14
  def infer(selected_index, prompt, style_prompt, inf_steps, guidance_scale, width, height, seed, lora_weight, progress=gr.Progress(track_tqdm=True)):
15
  try:
16
 
 
22
  custom_model = selected_lora["repo"]
23
  trigger_word = selected_lora["trigger_word"]
24
 
 
25
  result = client.submit(
26
  custom_model=custom_model,
27
  api_name="/load_model"
28
  )
29
  weight_name = result.result()[2]['value']
30
 
 
31
  prompt_arr = [trigger_word, prompt, style_prompt]
32
  prompt = '. '.join([element.strip() for element in prompt_arr if element.strip() != ''])
33
 
 
71
 
72
  def upscale(image, resolution, inf_steps, strength, hdr_effect, guidance_scale):
73
  try:
74
+ # other_client = Client("gokaygokay/Tile-Upscaler")
75
+ # result = other_client.predict(
76
+ # param_0=handle_file(image),
77
+ # param_1=resolution,
78
+ # param_2=inf_steps,
79
+ # param_3=strength,
80
+ # param_4=hdr_effect,
81
+ # param_5=guidance_scale,
82
+ # api_name="/wrapper"
83
+ # )
84
  return [image, image]
85
  return result
86
  except Exception as e: