wondervictor commited on
Commit
9095b80
1 Parent(s): b7936c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -5,12 +5,15 @@ from pip._internal import main
5
 
6
 
7
  # main(['install', 'timm==1.0.8'])
 
8
  # main(['install', 'samv2'])
9
- # main(['install', 'bitsandbytes', '--upgrade'])
 
10
  # main(['install', 'torch==2.1.2'])
11
  # main(['install', 'numpy==1.21.6'])
12
  import spaces
13
  import timm
 
14
 
15
  print("installed", timm.__version__)
16
  import gradio as gr
@@ -118,15 +121,17 @@ def inference_video(video_path, prompt):
118
  # save visualization
119
  video_writer = cv2.VideoWriter("demo_temp/out.mp4", fourcc, 30,
120
  (width, height))
121
- pbar = tqdm(input_frames)
122
- pbar.set_description("generating video: ")
123
- for i, file in enumerate(pbar):
124
  img = cv2.imread(os.path.join("demo_temp/input_frames", file))
125
  vis = img + np.array([0, 0, 128]) * output[i][1].transpose(1, 2, 0)
126
  vis = np.clip(vis, 0, 255)
127
  vis = np.uint8(vis)
128
  video_writer.write(vis)
 
129
  video_writer.release()
 
130
  return "demo_temp/out.mp4"
131
 
132
 
 
5
 
6
 
7
  # main(['install', 'timm==1.0.8'])
8
+ main(['install', 'setuptools==59.8.0'])
9
  # main(['install', 'samv2'])
10
+ main(['install', 'bitsandbytes', '--upgrade'])
11
+ main(['install', 'timm==1.0.8'])
12
  # main(['install', 'torch==2.1.2'])
13
  # main(['install', 'numpy==1.21.6'])
14
  import spaces
15
  import timm
16
+ import shutil
17
 
18
  print("installed", timm.__version__)
19
  import gradio as gr
 
121
  # save visualization
122
  video_writer = cv2.VideoWriter("demo_temp/out.mp4", fourcc, 30,
123
  (width, height))
124
+ # pbar = tqdm(input_frames)
125
+ # pbar.set_description("generating video: ")
126
+ for i, file in enumerate(input_frames):
127
  img = cv2.imread(os.path.join("demo_temp/input_frames", file))
128
  vis = img + np.array([0, 0, 128]) * output[i][1].transpose(1, 2, 0)
129
  vis = np.clip(vis, 0, 255)
130
  vis = np.uint8(vis)
131
  video_writer.write(vis)
132
+ shutil.rmtree("demo_temp/input_frames")
133
  video_writer.release()
134
+
135
  return "demo_temp/out.mp4"
136
 
137