patrickvonplaten commited on
Commit
c644570
1 Parent(s): a00529a
Files changed (3) hide show
  1. __pycache__/app.cpython-310.pyc +0 -0
  2. app.py +9 -8
  3. header.html +0 -3
__pycache__/app.cpython-310.pyc CHANGED
Binary files a/__pycache__/app.cpython-310.pyc and b/__pycache__/app.cpython-310.pyc differ
 
app.py CHANGED
@@ -1,10 +1,11 @@
1
  import gradio as gr
 
2
 
3
- from diffusers import DiffusionPipeline, UNet2DModel
4
  from share_btn import community_icon_html, loading_icon_html, share_js
5
 
6
- unet = UNet2DModel.from_pretrained("valhalla/sdxl-inpaint-ema")
7
- pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", unet=unet, torch_dtype=torch.float16, variant="fp16").to("cuda")
8
 
9
  def read_content(file_path: str) -> str:
10
  """read the content of target file
@@ -73,9 +74,11 @@ with image_blocks as demo:
73
  image = gr.Image(source='upload', tool='sketch', elem_id="image_upload", type="pil", label="Upload").style(height=400)
74
  with gr.Row(elem_id="prompt-container").style(mobile_collapse=False, equal_height=True):
75
  prompt = gr.Textbox(placeholder = 'Your prompt (what you want in place of what is erased)', show_label=False, elem_id="input-text")
76
- guidance_scale = gradio.Number(value=7.5, minimum=1.0, maximum=20.0)
77
- steps = gradio.Number(value=20, minimum=10, maximum=50)
78
- strength = gradio.Number(value=1.0, minimum=0.0, maximum=1.0)
 
 
79
 
80
  btn = gr.Button("Inpaint!").style(
81
  margin=False,
@@ -93,8 +96,6 @@ with image_blocks as demo:
93
  btn.click(fn=predict, inputs=[image, prompt, guidance_scale, steps, strength], outputs=[image_out, community_icon, loading_icon, share_button])
94
  share_button.click(None, [], [], _js=share_js)
95
 
96
-
97
-
98
  gr.HTML(
99
  """
100
  <div class="footer">
 
1
  import gradio as gr
2
+ import torch
3
 
4
+ from diffusers import AutoPipelineForInpainting, UNet2DConditionModel
5
  from share_btn import community_icon_html, loading_icon_html, share_js
6
 
7
+ unet = UNet2DConditionModel.from_pretrained("valhalla/sdxl-inpaint-ema")
8
+ pipe = AutoPipelineForInpainting.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", unet=unet, torch_dtype=torch.float16, variant="fp16").to("cuda")
9
 
10
  def read_content(file_path: str) -> str:
11
  """read the content of target file
 
74
  image = gr.Image(source='upload', tool='sketch', elem_id="image_upload", type="pil", label="Upload").style(height=400)
75
  with gr.Row(elem_id="prompt-container").style(mobile_collapse=False, equal_height=True):
76
  prompt = gr.Textbox(placeholder = 'Your prompt (what you want in place of what is erased)', show_label=False, elem_id="input-text")
77
+
78
+ with gr.Row(elem_id="prompt-container").style(mobile_collapse=False, equal_height=True):
79
+ guidance_scale = gr.Number(value=7.5, minimum=1.0, maximum=20.0, step=0.1, label="guidance_scale")
80
+ steps = gr.Number(value=20, minimum=10, maximum=50, step=0.1, label="steps")
81
+ strength = gr.Number(value=1.0, minimum=0.0, maximum=1.0, step=0.05, label="strength")
82
 
83
  btn = gr.Button("Inpaint!").style(
84
  margin=False,
 
96
  btn.click(fn=predict, inputs=[image, prompt, guidance_scale, steps, strength], outputs=[image_out, community_icon, loading_icon, share_button])
97
  share_button.click(None, [], [], _js=share_js)
98
 
 
 
99
  gr.HTML(
100
  """
101
  <div class="footer">
header.html CHANGED
@@ -6,9 +6,6 @@
6
  justify-content: center;
7
  margin-bottom: 10px;
8
  ">
9
- <img
10
- src="https://aeiljuispo.cloudimg.io/v7/https://s3.amazonaws.com/moonup/production/uploads/1665970599545-634cb15a4abe8405758d2e7e.jpeg"
11
- alt="Diffusers" width="64px">
12
  <h1 style="font-weight: 900; align-items: center; margin-bottom: 7px; margin-top: 20px;">
13
  Stable Diffusion XL Inpainting 🎨
14
  </h1>
 
6
  justify-content: center;
7
  margin-bottom: 10px;
8
  ">
 
 
 
9
  <h1 style="font-weight: 900; align-items: center; margin-bottom: 7px; margin-top: 20px;">
10
  Stable Diffusion XL Inpainting 🎨
11
  </h1>