amos1088 commited on
Commit
312f233
·
1 Parent(s): 74c4e79

test gradio

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -9,7 +9,7 @@ token = os.getenv("HF_TOKEN")
9
  login(token=token)
10
 
11
  # Model IDs for Stable Diffusion 1.5 and ControlNet
12
- model_id = "runwayml/stable-diffusion-v1-5" # Compatible with ControlNet
13
  controlnet_id = "lllyasviel/control_v11p_sd15_inpaint"
14
 
15
  # Load the ControlNet model and Stable Diffusion pipeline
@@ -21,7 +21,7 @@ pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
21
  pipe = pipe.to("cuda")
22
 
23
  @spaces.GPU
24
- def generate_image(prompt, reference_image):
25
  # Prepare the reference image for ControlNet
26
  reference_image = reference_image.convert("RGB").resize((512, 512))
27
 
@@ -40,7 +40,8 @@ interface = gr.Interface(
40
  fn=generate_image,
41
  inputs=[
42
  gr.Textbox(label="Prompt"),
43
- gr.Image(type="pil", label="Reference Image (Style)")
 
44
  ],
45
  outputs="image",
46
  title="Image Generation with Stable Diffusion 1.5 and ControlNet",
 
9
  login(token=token)
10
 
11
  # Model IDs for Stable Diffusion 1.5 and ControlNet
12
+ model_id = "stabilityai/stable-diffusion-3.5-large-turbo"
13
  controlnet_id = "lllyasviel/control_v11p_sd15_inpaint"
14
 
15
  # Load the ControlNet model and Stable Diffusion pipeline
 
21
  pipe = pipe.to("cuda")
22
 
23
  @spaces.GPU
24
+ def generate_image(prompt, reference_image,controlnet_conditioning_scale):
25
  # Prepare the reference image for ControlNet
26
  reference_image = reference_image.convert("RGB").resize((512, 512))
27
 
 
40
  fn=generate_image,
41
  inputs=[
42
  gr.Textbox(label="Prompt"),
43
+ gr.Image(type="pil", label="Reference Image (Style)"),
44
+ gr.Slider(label="Control Net Conditioning Scale",minimum=0,maximum=1),
45
  ],
46
  outputs="image",
47
  title="Image Generation with Stable Diffusion 1.5 and ControlNet",