lichorosario commited on
Commit
1dcbd47
1 Parent(s): 7ea4f8f

feat: Refactor upscale function to use new Tile-Upscaler client

Browse files
Files changed (1) hide show
  1. app.py +17 -17
app.py CHANGED
@@ -84,22 +84,22 @@ def update_selection(evt: gr.SelectData):
84
  )
85
 
86
 
87
- def upscale(image, resolution, inf_steps, strength, hdr_effect, guidance_scale):
88
- try:
89
- # other_client = Client("gokaygokay/Tile-Upscaler")
90
- # result = other_client.predict(
91
- # param_0=handle_file(image),
92
- # param_1=resolution,
93
- # param_2=inf_steps,
94
- # param_3=strength,
95
- # param_4=hdr_effect,
96
- # param_5=guidance_scale,
97
- # api_name="/wrapper"
98
- # )
99
- return [image, image]
100
- return result
101
- except Exception as e:
102
- gr.Warning("Error: " + str(e))
103
 
104
  css="""
105
  """
@@ -220,7 +220,7 @@ with gr.Blocks(css=css) as demo:
220
  )
221
 
222
  def upscale_with_fixed_values(image):
223
- return upscale(image, 768, 25, 0.4, 0.3, 7.5)
224
 
225
  scale_btn.click(
226
  fn=upscale_with_fixed_values,
 
84
  )
85
 
86
 
87
+ def upscale_image(image, resolution, num_inference_steps, strength, hdr, guidance_scale, controlnet_strength, scheduler_name):
88
+ result = client_tile_upscaler.predict(
89
+ param_0=handle_file(image),
90
+ param_1=resolution,
91
+ param_2=num_inference_steps,
92
+ param_3=strength,
93
+ param_4=hdr,
94
+ param_5=guidance_scale,
95
+ param_6=controlnet_strength,
96
+ param_7=scheduler_name,
97
+ api_name="/wrapper"
98
+ )
99
+ return result
100
+
101
+
102
+
103
 
104
  css="""
105
  """
 
220
  )
221
 
222
  def upscale_with_fixed_values(image):
223
+ return upscale_image(image, 768, 25, 0.4, 0.3, 7.5)
224
 
225
  scale_btn.click(
226
  fn=upscale_with_fixed_values,