CharlieAmalet commited on
Commit
aa2b83c
·
verified ·
1 Parent(s): 8bdd760

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -5
app.py CHANGED
@@ -1,6 +1,8 @@
1
- import gradio as gr
2
- #import gradio.helpers
 
3
  import torch
 
4
  import os
5
  import base64
6
  from glob import glob
@@ -23,7 +25,7 @@ pipe = StableVideoDiffusionPipeline.from_pretrained(
23
  variant="fp16"
24
  )
25
 
26
- pipe.save_pretrained("./model", variant="fp16")
27
 
28
  pipe.to("cuda")
29
  pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
@@ -105,8 +107,19 @@ def resize_image(image, output_size=(1024, 576)):
105
  cropped_image = resized_image.crop((left, top, right, bottom))
106
  return cropped_image
107
 
108
- with gr.Blocks() as demo:
109
- image = gr.Image(label="Upload your image", type="pil", height=500)
 
 
 
 
 
 
 
 
 
 
 
110
  generate_btn = gr.Button("Generate")
111
  base64_out = gr.Textbox(label="Base64 Video")
112
  seed = gr.Slider(label="Seed", value=42, randomize=False, minimum=0, maximum=max_64_bit_int, step=1)
 
1
+ import torch._dynamo
2
+ torch._dynamo.config.suppress_errors = True
3
+
4
  import torch
5
+ import gradio as gr
6
  import os
7
  import base64
8
  from glob import glob
 
25
  variant="fp16"
26
  )
27
 
28
+ # pipe.save_pretrained("./model", variant="fp16")
29
 
30
  pipe.to("cuda")
31
  pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
 
107
  cropped_image = resized_image.crop((left, top, right, bottom))
108
  return cropped_image
109
 
110
+
111
+ css = """
112
+ #img-display-input {
113
+ max-height: 60vh;
114
+ object-fit: contain;
115
+ }
116
+ #vid-display-output *{
117
+ max-height: 60vh;
118
+ }
119
+ """
120
+
121
+ with gr.Blocks(css=css) as demo:
122
+ image = gr.Image(label="Upload your image", type="pil", elem_id="img-display-output")
123
  generate_btn = gr.Button("Generate")
124
  base64_out = gr.Textbox(label="Base64 Video")
125
  seed = gr.Slider(label="Seed", value=42, randomize=False, minimum=0, maximum=max_64_bit_int, step=1)