Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ pipeline = FluxPipeline.from_pretrained(
|
|
15 |
|
16 |
|
17 |
@spaces.GPU()
|
18 |
-
def generate_image(image,
|
19 |
# Load the model
|
20 |
|
21 |
# Load and fuse base LoRA weights
|
@@ -27,6 +27,10 @@ def generate_image(image, height, width, prompt, guidance_scale, num_steps, lora
|
|
27 |
pipeline.load_lora_weights("nicolaus-huang/PhotoDoodle", weight_name=f"{lora_name}.safetensors")
|
28 |
pipeline.fuse_lora()
|
29 |
|
|
|
|
|
|
|
|
|
30 |
# Prepare the input image
|
31 |
condition_image = image.resize((height, width)).convert("RGB")
|
32 |
|
@@ -40,16 +44,18 @@ def generate_image(image, height, width, prompt, guidance_scale, num_steps, lora
|
|
40 |
num_inference_steps=num_steps,
|
41 |
max_sequence_length=512
|
42 |
).images[0]
|
|
|
|
|
43 |
|
44 |
-
return
|
45 |
|
46 |
# Create Gradio interface with sliders for numeric inputs
|
47 |
iface = gr.Interface(
|
48 |
fn=generate_image,
|
49 |
inputs=[
|
50 |
gr.Image(label="Input Image", type="pil", value=default_image),
|
51 |
-
gr.Slider(label="Height", value=768, minimum=256, maximum=1024, step=64),
|
52 |
-
gr.Slider(label="Width", value=512, minimum=256, maximum=1024, step=64),
|
53 |
gr.Textbox(label="Prompt", value="add a halo and wings for the cat by sksmagiceffects"),
|
54 |
gr.Slider(label="Guidance Scale", value=3.5, minimum=1.0, maximum=10.0, step=0.1),
|
55 |
gr.Slider(label="Number of Steps", value=20, minimum=1, maximum=100, step=1),
|
|
|
15 |
|
16 |
|
17 |
@spaces.GPU()
|
18 |
+
def generate_image(image, prompt, guidance_scale, num_steps, lora_name):
|
19 |
# Load the model
|
20 |
|
21 |
# Load and fuse base LoRA weights
|
|
|
27 |
pipeline.load_lora_weights("nicolaus-huang/PhotoDoodle", weight_name=f"{lora_name}.safetensors")
|
28 |
pipeline.fuse_lora()
|
29 |
|
30 |
+
height=768
|
31 |
+
width=512
|
32 |
+
|
33 |
+
|
34 |
# Prepare the input image
|
35 |
condition_image = image.resize((height, width)).convert("RGB")
|
36 |
|
|
|
44 |
num_inference_steps=num_steps,
|
45 |
max_sequence_length=512
|
46 |
).images[0]
|
47 |
+
|
48 |
+
final_image = image.resize(image.size)
|
49 |
|
50 |
+
return final_image
|
51 |
|
52 |
# Create Gradio interface with sliders for numeric inputs
|
53 |
iface = gr.Interface(
|
54 |
fn=generate_image,
|
55 |
inputs=[
|
56 |
gr.Image(label="Input Image", type="pil", value=default_image),
|
57 |
+
# gr.Slider(label="Height", value=768, minimum=256, maximum=1024, step=64),
|
58 |
+
# gr.Slider(label="Width", value=512, minimum=256, maximum=1024, step=64),
|
59 |
gr.Textbox(label="Prompt", value="add a halo and wings for the cat by sksmagiceffects"),
|
60 |
gr.Slider(label="Guidance Scale", value=3.5, minimum=1.0, maximum=10.0, step=0.1),
|
61 |
gr.Slider(label="Number of Steps", value=20, minimum=1, maximum=100, step=1),
|