Spaces:
Sleeping
Sleeping
Commit
·
3e2b1f9
1
Parent(s):
e4757ad
feat: Enable image upscaling with fixed values
Browse filesThe commented code and unused button in app.py have been removed. The upscale_with_fixed_values function has been implemented to upscale images with fixed values.
app.py
CHANGED
@@ -66,17 +66,18 @@ def update_selection(evt: gr.SelectData):
|
|
66 |
|
67 |
|
68 |
def upscale(image, resolution, inf_steps, strength, hdr_effect, guidance_scale):
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
80 |
|
81 |
css="""
|
82 |
"""
|
@@ -182,7 +183,7 @@ with gr.Blocks(css=css) as demo:
|
|
182 |
with gr.Row():
|
183 |
image_out = gr.Image(label="Image output")
|
184 |
image_upscaled = ImageSlider(label="Before / After", type="numpy")
|
185 |
-
|
186 |
|
187 |
selected_index = gr.State(None)
|
188 |
|
@@ -196,14 +197,14 @@ with gr.Blocks(css=css) as demo:
|
|
196 |
outputs=[]
|
197 |
)
|
198 |
|
199 |
-
|
200 |
-
|
201 |
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
|
208 |
|
209 |
gallery.select(update_selection, outputs=[prompt_in, selected_info, selected_index])
|
|
|
66 |
|
67 |
|
68 |
def upscale(image, resolution, inf_steps, strength, hdr_effect, guidance_scale):
|
69 |
+
return[image, image]
|
70 |
+
# client = Client("gokaygokay/Tile-Upscaler")
|
71 |
+
# result = client.predict(
|
72 |
+
# param_0=image,
|
73 |
+
# param_1=resolution,
|
74 |
+
# param_2=inf_steps,
|
75 |
+
# param_3=strength,
|
76 |
+
# param_4=hdr_effect,
|
77 |
+
# param_5=guidance_scale,
|
78 |
+
# api_name="/wrapper"
|
79 |
+
# )
|
80 |
+
# return result
|
81 |
|
82 |
css="""
|
83 |
"""
|
|
|
183 |
with gr.Row():
|
184 |
image_out = gr.Image(label="Image output")
|
185 |
image_upscaled = ImageSlider(label="Before / After", type="numpy")
|
186 |
+
scale_btn = gr.Button("Upscale")
|
187 |
|
188 |
selected_index = gr.State(None)
|
189 |
|
|
|
197 |
outputs=[]
|
198 |
)
|
199 |
|
200 |
+
def upscale_with_fixed_values(image):
|
201 |
+
return upscale(image, 768, 25, 0.4, 0.3, 7.5)
|
202 |
|
203 |
+
scale_btn.click(
|
204 |
+
fn=upscale_with_fixed_values,
|
205 |
+
inputs=[image_out],
|
206 |
+
outputs=[image_upscaled]
|
207 |
+
)
|
208 |
|
209 |
|
210 |
gallery.select(update_selection, outputs=[prompt_in, selected_info, selected_index])
|