mokady commited on
Commit
56dd0de
1 Parent(s): 7565e99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -1,9 +1,12 @@
1
  import gradio as gr
2
  import torch
3
 
4
- from diffusers import AutoPipelineForInpainting, UNet2DConditionModel
5
  import diffusers
6
- from share_btn import community_icon_html, loading_icon_html, share_js
 
 
 
 
7
 
8
  device = "cuda" if torch.cuda.is_available() else "cpu"
9
  unet = UNet2DConditionModel.from_pretrained(
@@ -12,7 +15,8 @@ unet = UNet2DConditionModel.from_pretrained(
12
  torch_dtype=torch.float16,
13
  )
14
 
15
- scheduler = DDIMScheduler.from_pretrained("briaai/BRIA-2.3", subfolder="scheduler",clip_sample=False)
 
16
 
17
  pipe = StableDiffusionXLInpaintPipeline.from_pretrained(
18
  "briaai/BRIA-2.3",
@@ -114,15 +118,11 @@ with image_blocks as demo:
114
 
115
  with gr.Column():
116
  image_out = gr.Image(label="Output", elem_id="output-img", height=400)
117
- with gr.Group(elem_id="share-btn-container", visible=False) as share_btn_container:
118
- community_icon = gr.HTML(community_icon_html)
119
- loading_icon = gr.HTML(loading_icon_html)
120
- share_button = gr.Button("Share to community", elem_id="share-btn",visible=True)
121
 
122
 
123
  btn.click(fn=predict, inputs=[image, prompt, negative_prompt, guidance_scale, steps, strength, scheduler], outputs=[image_out, share_btn_container], api_name='run')
124
  prompt.submit(fn=predict, inputs=[image, prompt, negative_prompt, guidance_scale, steps, strength, scheduler], outputs=[image_out, share_btn_container])
125
- share_button.click(None, [], [], _js=share_js)
126
 
127
  gr.Examples(
128
  examples=[
 
1
  import gradio as gr
2
  import torch
3
 
 
4
  import diffusers
5
+ import os
6
+ hf_token = os.environ.get("HF_TOKEN")
7
+ import spaces
8
+ from diffusers import StableDiffusionXLInpaintPipeline, DDIMScheduler, UNet2DConditionModel
9
+
10
 
11
  device = "cuda" if torch.cuda.is_available() else "cpu"
12
  unet = UNet2DConditionModel.from_pretrained(
 
15
  torch_dtype=torch.float16,
16
  )
17
 
18
+ scheduler = DDIMScheduler.from_pretrained("briaai/BRIA-2.3", subfolder="scheduler",
19
+ rescale_betas_zero_snr=True,prediction_type='v_prediction',timestep_spacing="trailing",clip_sample=False)
20
 
21
  pipe = StableDiffusionXLInpaintPipeline.from_pretrained(
22
  "briaai/BRIA-2.3",
 
118
 
119
  with gr.Column():
120
  image_out = gr.Image(label="Output", elem_id="output-img", height=400)
121
+
 
 
 
122
 
123
 
124
  btn.click(fn=predict, inputs=[image, prompt, negative_prompt, guidance_scale, steps, strength, scheduler], outputs=[image_out, share_btn_container], api_name='run')
125
  prompt.submit(fn=predict, inputs=[image, prompt, negative_prompt, guidance_scale, steps, strength, scheduler], outputs=[image_out, share_btn_container])
 
126
 
127
  gr.Examples(
128
  examples=[