lorocksUMD commited on
Commit
c939ae3
·
verified ·
1 Parent(s): 6a6acad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -20
app.py CHANGED
@@ -1,10 +1,3 @@
1
- import subprocess
2
- import os
3
-
4
- os.chdir('DenseAV')
5
- # subprocess.run(["cd", "DenseAV"])
6
- subprocess.run(["pip", "install", "-e", "."])
7
-
8
  import csv
9
  import os
10
  import tempfile
@@ -17,10 +10,11 @@ import torchvision.transforms as T
17
  from PIL import Image
18
  # from featup.util import norm
19
  from torchaudio.functional import resample
20
-
21
-
22
  from os.path import join
23
 
 
 
 
24
 
25
  mode = "hf"
26
 
@@ -76,19 +70,9 @@ video_output2 = gr.Video(label="Multi-Head Audio Video Attention (Only Availible
76
  height=480)
77
  video_output3 = gr.Video(label="Visual Features", height=480)
78
 
79
- models = {}
80
-
81
 
82
  def process_video(video, model_option):
83
- from denseav.train import LitAVAligner
84
- from denseav.plotting import plot_attention_video, plot_2head_attention_video, plot_feature_video
85
- from denseav.shared import norm, crop_to_divisor, blur_dim
86
-
87
- global models
88
-
89
- if len(models) == 0:
90
- models = {o: LitAVAligner.from_pretrained(f"mhamilton723/DenseAV-{o}") for o in options}
91
-
92
  # model = models[model_option].cuda()
93
  model = models[model_option]
94
 
 
 
 
 
 
 
 
 
1
  import csv
2
  import os
3
  import tempfile
 
10
  from PIL import Image
11
  # from featup.util import norm
12
  from torchaudio.functional import resample
 
 
13
  from os.path import join
14
 
15
+ from DenseAV.denseav.train import LitAVAligner
16
+ from DenseAV.denseav.plotting import plot_attention_video, plot_2head_attention_video, plot_feature_video
17
+ from DenseAV.denseav.shared import norm, crop_to_divisor, blur_dim
18
 
19
  mode = "hf"
20
 
 
70
  height=480)
71
  video_output3 = gr.Video(label="Visual Features", height=480)
72
 
73
+ models = {o: LitAVAligner.from_pretrained(f"mhamilton723/DenseAV-{o}") for o in options}
 
74
 
75
  def process_video(video, model_option):
 
 
 
 
 
 
 
 
 
76
  # model = models[model_option].cuda()
77
  model = models[model_option]
78