Spaces:
Running
on
Zero
Running
on
Zero
upload
Browse files
app.py
CHANGED
|
@@ -179,13 +179,7 @@ def infer(
|
|
| 179 |
return result, seed, gr.Button(visible=True)
|
| 180 |
|
| 181 |
# Wrapper for examples to handle file paths
|
| 182 |
-
|
| 183 |
-
def infer_example(input_image_path, prompt, lora_adapter):
|
| 184 |
-
input_pil = Image.open(input_image_path).convert("RGB")
|
| 185 |
-
width, height = update_dimensions_on_upload(input_pil)
|
| 186 |
-
# Set default values for example inference
|
| 187 |
-
result, seed, _ = infer(input_pil, prompt, lora_adapter, 0, True, 4.0, 20, width, height)
|
| 188 |
-
return result, seed
|
| 189 |
|
| 190 |
# --- UI Layout ---
|
| 191 |
css="""
|
|
@@ -203,7 +197,7 @@ with gr.Blocks(css=css, theme=qwen_theme) as demo:
|
|
| 203 |
|
| 204 |
with gr.Row():
|
| 205 |
with gr.Column():
|
| 206 |
-
input_image = gr.Image(label="Upload Image", type="pil"
|
| 207 |
|
| 208 |
lora_adapter = gr.Dropdown(
|
| 209 |
label="Choose Editing Style",
|
|
@@ -219,6 +213,12 @@ with gr.Blocks(css=css, theme=qwen_theme) as demo:
|
|
| 219 |
|
| 220 |
run_button = gr.Button("Run", variant="primary")
|
| 221 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
with gr.Accordion("⚙️ Advanced Settings", open=False):
|
| 223 |
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
|
| 224 |
randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)
|
|
@@ -227,11 +227,7 @@ with gr.Blocks(css=css, theme=qwen_theme) as demo:
|
|
| 227 |
# Hidden sliders to hold image dimensions
|
| 228 |
height = gr.Slider(label="Height", minimum=256, maximum=1024, step=8, value=1024, visible=False)
|
| 229 |
width = gr.Slider(label="Width", minimum=256, maximum=1024, step=8, value=1024, visible=False)
|
| 230 |
-
|
| 231 |
-
with gr.Column():
|
| 232 |
-
output_image = gr.Image(label="Output Image", interactive=False)
|
| 233 |
-
reuse_button = gr.Button("Reuse this image", visible=False)
|
| 234 |
-
|
| 235 |
gr.Examples(
|
| 236 |
examples=[
|
| 237 |
["examples/anime_example.jpg", "transform into anime", "Photo-to-Anime"],
|
|
|
|
| 179 |
return result, seed, gr.Button(visible=True)
|
| 180 |
|
| 181 |
# Wrapper for examples to handle file paths
|
| 182 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
|
| 184 |
# --- UI Layout ---
|
| 185 |
css="""
|
|
|
|
| 197 |
|
| 198 |
with gr.Row():
|
| 199 |
with gr.Column():
|
| 200 |
+
input_image = gr.Image(label="Upload Image", type="pil")
|
| 201 |
|
| 202 |
lora_adapter = gr.Dropdown(
|
| 203 |
label="Choose Editing Style",
|
|
|
|
| 213 |
|
| 214 |
run_button = gr.Button("Run", variant="primary")
|
| 215 |
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
with gr.Column():
|
| 219 |
+
output_image = gr.Image(label="Output Image", interactive=False)
|
| 220 |
+
#reuse_button = gr.Button("Reuse this image", visible=False)
|
| 221 |
+
|
| 222 |
with gr.Accordion("⚙️ Advanced Settings", open=False):
|
| 223 |
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
|
| 224 |
randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)
|
|
|
|
| 227 |
# Hidden sliders to hold image dimensions
|
| 228 |
height = gr.Slider(label="Height", minimum=256, maximum=1024, step=8, value=1024, visible=False)
|
| 229 |
width = gr.Slider(label="Width", minimum=256, maximum=1024, step=8, value=1024, visible=False)
|
| 230 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
gr.Examples(
|
| 232 |
examples=[
|
| 233 |
["examples/anime_example.jpg", "transform into anime", "Photo-to-Anime"],
|