clinteroni commited on
Commit
98e453d
1 Parent(s): 6bfc071

Add an example

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. app.py +13 -4
  3. examples/Coucang.jpg +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.jpg filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -6,10 +6,16 @@ import random
6
  import spaces
7
 
8
  from diffusers import DPMSolverMultistepScheduler, StableDiffusionXLPipeline
 
9
 
10
  DESCRIPTION='''
11
  This uses code lifted almost verbatim from
12
- [Outpainting II - Differential Diffusion](https://huggingface.co/blog/OzzyGT/outpainting-differential-diffusion).
 
 
 
 
 
13
  '''
14
 
15
  xlp_kwargs = {
@@ -271,12 +277,11 @@ def outpaint(pil_image, direction='right', times_to_expand=4, guidance_scale=4.0
271
  color_converted = cv2.cvtColor(final_image, cv2.COLOR_BGR2RGB)
272
  return color_converted
273
 
274
-
275
  gradio_app = gr.Interface(
276
  outpaint,
277
  inputs=[
278
  gr.Image(label="Select start image", sources=[
279
- 'upload', 'webcam'], type='pil'),
280
  gr.Radio(["left", "right", "top", 'bottom'], label="Direction",
281
  info="Outward from which edge to paint?", value='right'),
282
  gr.Slider(2, 4, step=1, value=4, label="Times to expand",
@@ -287,8 +292,12 @@ gradio_app = gr.Interface(
287
  info="Choose between 250 and 500"),
288
  ],
289
  outputs=[gr.Image(label="Processed Image")],
 
 
 
290
  title="Outpainting with differential diffusion demo",
291
- description=DESCRIPTION
 
292
  )
293
 
294
  if __name__ == "__main__":
 
6
  import spaces
7
 
8
  from diffusers import DPMSolverMultistepScheduler, StableDiffusionXLPipeline
9
+ from diffusers.utils import load_image
10
 
11
  DESCRIPTION='''
12
  This uses code lifted almost verbatim from
13
+ [Outpainting II - Differential Diffusion](https://huggingface.co/blog/OzzyGT/outpainting-differential-diffusion). This only works well on blurry edges.
14
+ '''
15
+
16
+ ARTICLE='''
17
+ The [example image](https://commons.wikimedia.org/wiki/File:Coucang.jpg) is by Aprisonsan
18
+ and licensed under CC-BY-SA 4.0 International.
19
  '''
20
 
21
  xlp_kwargs = {
 
277
  color_converted = cv2.cvtColor(final_image, cv2.COLOR_BGR2RGB)
278
  return color_converted
279
 
 
280
  gradio_app = gr.Interface(
281
  outpaint,
282
  inputs=[
283
  gr.Image(label="Select start image", sources=[
284
+ 'upload', 'clipboard'], type='pil'),
285
  gr.Radio(["left", "right", "top", 'bottom'], label="Direction",
286
  info="Outward from which edge to paint?", value='right'),
287
  gr.Slider(2, 4, step=1, value=4, label="Times to expand",
 
292
  info="Choose between 250 and 500"),
293
  ],
294
  outputs=[gr.Image(label="Processed Image")],
295
+ examples=[
296
+ [load_image('examples/Coucang.jpg'), 'right', 4, 5, 500]
297
+ ],
298
  title="Outpainting with differential diffusion demo",
299
+ description=DESCRIPTION,
300
+ article=ARTICLE
301
  )
302
 
303
  if __name__ == "__main__":
examples/Coucang.jpg ADDED

Git LFS Details

  • SHA256: af10cbabe8e6b4e33c03cfd0d6365fed44cd1e724fb3feaa42cddd65faef9ecb
  • Pointer size: 132 Bytes
  • Size of remote file: 4.89 MB