Spaces:
Sleeping
Sleeping
lichorosario
commited on
Commit
•
95fcad5
1
Parent(s):
931f2d6
feat: Update app.py to use new Tile-Upscaler client
Browse files
app.py
CHANGED
@@ -41,7 +41,6 @@ def infer(selected_index, prompt, style_prompt, inf_steps, guidance_scale, width
|
|
41 |
trigger_word = selected_lora["trigger_word"]
|
42 |
|
43 |
global client_custom_model
|
44 |
-
global client_tile_upscaler
|
45 |
|
46 |
if client_custom_model is None:
|
47 |
try:
|
@@ -52,16 +51,6 @@ def infer(selected_index, prompt, style_prompt, inf_steps, guidance_scale, width
|
|
52 |
client_custom_model = None
|
53 |
raise gr.Error("Failed to load client for " + custom_model_url)
|
54 |
|
55 |
-
if client_tile_upscaler is None:
|
56 |
-
try:
|
57 |
-
client_tile_upscaler = Client(tile_upscaler_url)
|
58 |
-
print(f"Loaded custom model from {tile_upscaler_url}")
|
59 |
-
except ValueError as e:
|
60 |
-
print(f"Failed to load custom model: {e}")
|
61 |
-
client_custom_model = None
|
62 |
-
raise gr.Error("Failed to load client for " + tile_upscaler_url)
|
63 |
-
|
64 |
-
|
65 |
|
66 |
result = client_custom_model.submit(
|
67 |
custom_model=custom_model,
|
@@ -111,18 +100,29 @@ def update_selection(evt: gr.SelectData):
|
|
111 |
|
112 |
|
113 |
def upscale_image(image, resolution, num_inference_steps, strength, hdr, guidance_scale, controlnet_strength, scheduler_name):
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
|
128 |
|
|
|
41 |
trigger_word = selected_lora["trigger_word"]
|
42 |
|
43 |
global client_custom_model
|
|
|
44 |
|
45 |
if client_custom_model is None:
|
46 |
try:
|
|
|
51 |
client_custom_model = None
|
52 |
raise gr.Error("Failed to load client for " + custom_model_url)
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
result = client_custom_model.submit(
|
56 |
custom_model=custom_model,
|
|
|
100 |
|
101 |
|
102 |
def upscale_image(image, resolution, num_inference_steps, strength, hdr, guidance_scale, controlnet_strength, scheduler_name):
|
103 |
+
global client_tile_upscaler
|
104 |
+
|
105 |
+
if client_tile_upscaler is None:
|
106 |
+
try:
|
107 |
+
client_tile_upscaler = Client(tile_upscaler_url)
|
108 |
+
print(f"Loaded custom model from {tile_upscaler_url}")
|
109 |
+
except ValueError as e:
|
110 |
+
print(f"Failed to load custom model: {e}")
|
111 |
+
client_custom_model = None
|
112 |
+
raise gr.Error("Failed to load client for " + tile_upscaler_url)
|
113 |
+
|
114 |
+
result = client_tile_upscaler.predict(
|
115 |
+
param_0=handle_file(image),
|
116 |
+
param_1=resolution,
|
117 |
+
param_2=num_inference_steps,
|
118 |
+
param_3=strength,
|
119 |
+
param_4=hdr,
|
120 |
+
param_5=guidance_scale,
|
121 |
+
param_6=controlnet_strength,
|
122 |
+
param_7=scheduler_name,
|
123 |
+
api_name="/wrapper"
|
124 |
+
)
|
125 |
+
return result
|
126 |
|
127 |
|
128 |
|