Xuanyou commited on
Commit
068485c
·
verified ·
1 Parent(s): 06797d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -22,6 +22,23 @@ from huggingface_hub import snapshot_download
22
  import subprocess
23
  import sys
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  @spaces.GPU(duration=120)
26
  def download_liveportrait():
27
  """
 
22
  import subprocess
23
  import sys
24
 
25
+ @spaces.GPU(duration=120)
26
+ def install_deformable_detr():
27
+ # 克隆 Deformable-DETR 仓库
28
+ if not os.path.exists('Deformable-DETR'):
29
+ subprocess.run(['git', 'clone', 'https://github.com/fundamentalvision/Deformable-DETR.git'])
30
+
31
+ # 安装依赖
32
+ subprocess.run(['pip', 'install', '-r', 'Deformable-DETR/requirements.txt'])
33
+
34
+ # 编译 CUDA 操作符
35
+ os.chdir('Deformable-DETR/models/ops')
36
+ subprocess.run(['sh', './make.sh'])
37
+ os.chdir('../../../..')
38
+
39
+ # 在应用启动时调用安装函数
40
+ install_deformable_detr()
41
+
42
  @spaces.GPU(duration=120)
43
  def download_liveportrait():
44
  """