Manjushri commited on
Commit
4f2f39b
1 Parent(s): ab6b2b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -16,16 +16,16 @@ sd_2_1_4x = StableDiffusionUpscalePipeline.from_pretrained(model_4x, torch_dtype
16
 
17
  # Define the function that will be called when the interface is used
18
 
19
- def upscale_image(model, input_image, prompt, negative_prompt, guidance):
20
  # Convert the image
21
  generator = torch.manual_seed(999999)
22
  input_image = Image.open(input_image).convert("RGB")
23
  # Upscale the image using the selected model
24
  if model == "SD 2.1 4x Upscaler":
25
  low_res_img = input_image.resize((128, 128))
26
- upscaled_image = sd_2_1_4x(prompt, negative_prompt, image=low_res_img, num_inference_steps=5, guidance_scale=guidance).images[0]
27
  else:
28
- upscaled_image = sd_2_0_2x(prompt, negative_prompt, image=input_image, num_inference_steps=5, guidance_scale=guidance).images[0]
29
  # Return the upscaled image
30
  return upscaled_image
31
 
@@ -35,7 +35,6 @@ gr.Interface(
35
  inputs=[gr.Radio(["SD 2.0 2x Latent Upscaler", "SD 2.1 4x Upscaler"], label="Models:"),
36
  gr.Image(type="filepath", label = "Raw Image"),
37
  gr.Textbox(label='Guide the AI Upscaling'),
38
- gr.Textbox(label='What you do not want AI to generate during Upscaling'),
39
  gr.Slider(minimum=0, value=0, maximum=3, label='Guidance Scale')],
40
  outputs=gr.Image(type="filepath", label = "Upscaled Image"),
41
  title="SD Image Upscaler",
 
16
 
17
  # Define the function that will be called when the interface is used
18
 
19
+ def upscale_image(model, input_image, prompt, guidance):
20
  # Convert the image
21
  generator = torch.manual_seed(999999)
22
  input_image = Image.open(input_image).convert("RGB")
23
  # Upscale the image using the selected model
24
  if model == "SD 2.1 4x Upscaler":
25
  low_res_img = input_image.resize((128, 128))
26
+ upscaled_image = sd_2_1_4x(prompt, image=low_res_img, num_inference_steps=5, guidance_scale=guidance).images[0]
27
  else:
28
+ upscaled_image = sd_2_0_2x(prompt, image=input_image, num_inference_steps=5, guidance_scale=guidance).images[0]
29
  # Return the upscaled image
30
  return upscaled_image
31
 
 
35
  inputs=[gr.Radio(["SD 2.0 2x Latent Upscaler", "SD 2.1 4x Upscaler"], label="Models:"),
36
  gr.Image(type="filepath", label = "Raw Image"),
37
  gr.Textbox(label='Guide the AI Upscaling'),
 
38
  gr.Slider(minimum=0, value=0, maximum=3, label='Guidance Scale')],
39
  outputs=gr.Image(type="filepath", label = "Upscaled Image"),
40
  title="SD Image Upscaler",