lnyan commited on
Commit
a5b25be
1 Parent(s): 26bec7c

Update to v0.1.0

Browse files
Files changed (3) hide show
  1. app.py +4 -2
  2. canvas.py +3 -3
  3. index.html +4 -4
app.py CHANGED
@@ -459,6 +459,8 @@ class StableDiffusion:
459
  "runwayml/stable-diffusion-inpainting", use_auth_token=token,
460
  ).to(device)
461
  text2img_unet.to(device)
 
 
462
  text2img = StableDiffusionPipeline(
463
  vae=inpaint.vae,
464
  text_encoder=inpaint.text_encoder,
@@ -769,7 +771,7 @@ proceed_button_js = load_js("proceed")
769
  setup_button_js = load_js("setup")
770
 
771
  if RUN_IN_SPACE:
772
- get_model(token=os.environ.get("hftoken", ""), model_choice=ModelChoice.INPAINTING.value)
773
 
774
  blocks = gr.Blocks(
775
  title="StableDiffusion-Infinity",
@@ -788,7 +790,7 @@ with blocks as demo:
788
  # title
789
  title = gr.Markdown(
790
  """
791
- **stablediffusion-infinity**: Outpainting with Stable Diffusion on an infinite canvas: [https://github.com/lkwq007/stablediffusion-infinity](https://github.com/lkwq007/stablediffusion-infinity) [Open_In_Colab](https://colab.research.google.com/github/lkwq007/stablediffusion-infinity/blob/master/stablediffusion_infinity_colab.ipynb) [Setup_Locally](https://github.com/lkwq007/stablediffusion-infinity/blob/master/docs/setup_guide.md)
792
  """,
793
  elem_id="markdown",
794
  )
 
459
  "runwayml/stable-diffusion-inpainting", use_auth_token=token,
460
  ).to(device)
461
  text2img_unet.to(device)
462
+ del text2img
463
+ gc.collect()
464
  text2img = StableDiffusionPipeline(
465
  vae=inpaint.vae,
466
  text_encoder=inpaint.text_encoder,
 
771
  setup_button_js = load_js("setup")
772
 
773
  if RUN_IN_SPACE:
774
+ get_model(token=os.environ.get("hftoken", ""), model_choice=ModelChoice.INPAINTING_IMG2IMG.value)
775
 
776
  blocks = gr.Blocks(
777
  title="StableDiffusion-Infinity",
 
790
  # title
791
  title = gr.Markdown(
792
  """
793
+ **stablediffusion-infinity**: Outpainting with Stable Diffusion on an infinite canvas: [https://github.com/lkwq007/stablediffusion-infinity](https://github.com/lkwq007/stablediffusion-infinity) \[[Open In Colab](https://colab.research.google.com/github/lkwq007/stablediffusion-infinity/blob/master/stablediffusion_infinity_colab.ipynb)\] \[[Setup Locally](https://github.com/lkwq007/stablediffusion-infinity/blob/master/docs/setup_guide.md)\]
794
  """,
795
  elem_id="markdown",
796
  )
canvas.py CHANGED
@@ -255,9 +255,9 @@ class InfCanvas:
255
  self.update_view_pos(int(xo), int(yo))
256
  self.cached_view_pos=tuple(self.view_pos)
257
  self.canvas[2].canvas.style.display="none"
258
- large_buffer=self.data2array(self.view_pos[0]-self.width//2,self.view_pos[1]-self.height//2,min(self.width*2,self.patch_size*2),min(self.height*2,self.patch_size*2))
259
- self.canvas[2].canvas.width=2*self.width
260
- self.canvas[2].canvas.height=2*self.height
261
  # self.canvas[2].canvas.style.width=""
262
  # self.canvas[2].canvas.style.height=""
263
  self.canvas[2].put_image_data(large_buffer,0,0)
 
255
  self.update_view_pos(int(xo), int(yo))
256
  self.cached_view_pos=tuple(self.view_pos)
257
  self.canvas[2].canvas.style.display="none"
258
+ large_buffer=self.data2array(self.view_pos[0]-self.width//2,self.view_pos[1]-self.height//2,min(self.width*2,self.patch_size),min(self.height*2,self.patch_size))
259
+ self.canvas[2].canvas.width=large_buffer.shape[1]
260
+ self.canvas[2].canvas.height=large_buffer.shape[0]
261
  # self.canvas[2].canvas.style.width=""
262
  # self.canvas[2].canvas.style.height=""
263
  self.canvas[2].put_image_data(large_buffer,0,0)
index.html CHANGED
@@ -4,11 +4,11 @@
4
  <meta charset="utf-8">
5
  <link rel="icon" type="image/x-icon" href="./favicon.png">
6
 
7
- <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/lkwq007/stablediffusion-infinity@master/css/w2ui.min.css">
8
- <script type="text/javascript" src="https://cdn.jsdelivr.net/gh/lkwq007/stablediffusion-infinity@master/js/w2ui.min.js"></script>
9
  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
10
- <script src="https://cdn.jsdelivr.net/gh/lkwq007/stablediffusion-infinity@master/js/fabric.min.js"></script>
11
- <script defer src="https://cdn.jsdelivr.net/gh/lkwq007/stablediffusion-infinity@master/js/toolbar.js"></script>
12
 
13
  <link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
14
  <script defer src="https://pyscript.net/alpha/pyscript.js"></script>
 
4
  <meta charset="utf-8">
5
  <link rel="icon" type="image/x-icon" href="./favicon.png">
6
 
7
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/lkwq007/stablediffusion-infinity@v0.1.0/css/w2ui.min.css">
8
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/gh/lkwq007/stablediffusion-infinity@v0.1.0/js/w2ui.min.js"></script>
9
  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
10
+ <script src="https://cdn.jsdelivr.net/gh/lkwq007/stablediffusion-infinity@v0.1.0/js/fabric.min.js"></script>
11
+ <script defer src="https://cdn.jsdelivr.net/gh/lkwq007/stablediffusion-infinity@v0.1.0/js/toolbar.js"></script>
12
 
13
  <link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
14
  <script defer src="https://pyscript.net/alpha/pyscript.js"></script>