zhiweili
commited on
Commit
·
b8883eb
1
Parent(s):
d538d26
add steps
Browse files- app_upscale.py +4 -2
app_upscale.py
CHANGED
|
@@ -26,10 +26,11 @@ DEFAULT_CATEGORY = "face"
|
|
| 26 |
|
| 27 |
def create_demo() -> gr.Blocks:
|
| 28 |
|
| 29 |
-
@spaces.GPU(duration=
|
| 30 |
def upscale_image(
|
| 31 |
input_image: Image,
|
| 32 |
prompt: str,
|
|
|
|
| 33 |
):
|
| 34 |
time_cost_str = ''
|
| 35 |
run_task_time = 0
|
|
@@ -56,6 +57,7 @@ def create_demo() -> gr.Blocks:
|
|
| 56 |
with gr.Column():
|
| 57 |
input_image_prompt = gr.Textbox(lines=1, label="Input Image Prompt", value=DEFAULT_SRC_PROMPT)
|
| 58 |
with gr.Column():
|
|
|
|
| 59 |
g_btn = gr.Button("Upscale Image")
|
| 60 |
|
| 61 |
with gr.Row():
|
|
@@ -78,7 +80,7 @@ def create_demo() -> gr.Blocks:
|
|
| 78 |
outputs=[origin_area_image, croper],
|
| 79 |
).success(
|
| 80 |
fn=upscale_image,
|
| 81 |
-
inputs=[origin_area_image, input_image_prompt],
|
| 82 |
outputs=[upscaled_image, generated_cost],
|
| 83 |
).success(
|
| 84 |
fn=restore_result,
|
|
|
|
| 26 |
|
| 27 |
def create_demo() -> gr.Blocks:
|
| 28 |
|
| 29 |
+
@spaces.GPU(duration=30)
|
| 30 |
def upscale_image(
|
| 31 |
input_image: Image,
|
| 32 |
prompt: str,
|
| 33 |
+
num_inference_steps: int = 10,
|
| 34 |
):
|
| 35 |
time_cost_str = ''
|
| 36 |
run_task_time = 0
|
|
|
|
| 57 |
with gr.Column():
|
| 58 |
input_image_prompt = gr.Textbox(lines=1, label="Input Image Prompt", value=DEFAULT_SRC_PROMPT)
|
| 59 |
with gr.Column():
|
| 60 |
+
num_inference_steps = gr.Number(label="Num Inference Steps", value=5)
|
| 61 |
g_btn = gr.Button("Upscale Image")
|
| 62 |
|
| 63 |
with gr.Row():
|
|
|
|
| 80 |
outputs=[origin_area_image, croper],
|
| 81 |
).success(
|
| 82 |
fn=upscale_image,
|
| 83 |
+
inputs=[origin_area_image, input_image_prompt, num_inference_steps],
|
| 84 |
outputs=[upscaled_image, generated_cost],
|
| 85 |
).success(
|
| 86 |
fn=restore_result,
|