amos1088 commited on
Commit
7957b28
·
1 Parent(s): c4543a1
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -55,7 +55,7 @@ pipe.init_ipadapter(
55
  # Step 6: Gradio Function
56
  # ----------------------------
57
  @spaces.GPU
58
- def gui_generation(prompt, ref_img, guidance_scale, ipadapter_scale):
59
 
60
 
61
  ref_img = load_image(ref_img.name).convert('RGB')
@@ -65,7 +65,7 @@ def gui_generation(prompt, ref_img, guidance_scale, ipadapter_scale):
65
  width=1024,
66
  height=1024,
67
  prompt=prompt,
68
- negative_prompt="lowres, low quality, worst quality",
69
  num_inference_steps=24,
70
  guidance_scale=guidance_scale,
71
  generator=torch.Generator("cuda").manual_seed(42),
@@ -80,6 +80,8 @@ def gui_generation(prompt, ref_img, guidance_scale, ipadapter_scale):
80
  # Step 7: Gradio Interface
81
  # ----------------------------
82
  prompt_box = gr.Textbox(label="Prompt", placeholder="Enter your image generation prompt")
 
 
83
  ref_img = gr.File(label="Upload Reference Image")
84
  guidance_slider = gr.Slider(
85
  label="Guidance Scale",
@@ -101,7 +103,7 @@ ipadapter_slider = gr.Slider(
101
 
102
  interface = gr.Interface(
103
  fn=gui_generation,
104
- inputs=[prompt_box, ref_img, guidance_slider, ipadapter_slider],
105
  outputs="image",
106
  title="Image Generation with Stable Diffusion 3.5 Large and IP-Adapter",
107
  description="Generates an image based on a text prompt and a reference image using Stable Diffusion 3.5 Large with IP-Adapter."
 
55
  # Step 6: Gradio Function
56
  # ----------------------------
57
  @spaces.GPU
58
+ def gui_generation(prompt,negative_prompt, ref_img, guidance_scale, ipadapter_scale):
59
 
60
 
61
  ref_img = load_image(ref_img.name).convert('RGB')
 
65
  width=1024,
66
  height=1024,
67
  prompt=prompt,
68
+ negative_prompt=negative_prompt,
69
  num_inference_steps=24,
70
  guidance_scale=guidance_scale,
71
  generator=torch.Generator("cuda").manual_seed(42),
 
80
  # Step 7: Gradio Interface
81
  # ----------------------------
82
  prompt_box = gr.Textbox(label="Prompt", placeholder="Enter your image generation prompt")
83
+ negative_prompt_box = gr.Textbox(label="Negative Prompt", placeholder="Enter your image generation prompt",value="lowres, low quality, worst quality")
84
+
85
  ref_img = gr.File(label="Upload Reference Image")
86
  guidance_slider = gr.Slider(
87
  label="Guidance Scale",
 
103
 
104
  interface = gr.Interface(
105
  fn=gui_generation,
106
+ inputs=[prompt_box,negative_prompt_box, ref_img, guidance_slider, ipadapter_slider],
107
  outputs="image",
108
  title="Image Generation with Stable Diffusion 3.5 Large and IP-Adapter",
109
  description="Generates an image based on a text prompt and a reference image using Stable Diffusion 3.5 Large with IP-Adapter."