mirror of
https://huggingface.co/spaces/H-Liu1997/TANGO
synced 2026-04-22 16:17:09 +08:00
Fix build errors and add Zero GPU support
- Add packages.txt for system dependencies (ffmpeg, mesa, OpenGL) - Add spaces module import for Zero GPU decorator - Fix Gradio API compatibility (remove show_share_button) - Add PYOPENGL_PLATFORM environment variable - Pin transformers==4.30.2 for PyTorch 2.1.0 compatibility - Update Python version to 3.10.13 for Zero GPU support
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
---
|
||||
title: TANGO
|
||||
emoji: 🐠
|
||||
emoji: "🐠"
|
||||
colorFrom: blue
|
||||
colorTo: gray
|
||||
sdk: gradio
|
||||
sdk_version: 5.34.2
|
||||
python_version: 3.10.16
|
||||
python_version: 3.10.13
|
||||
app_file: app.py
|
||||
pinned: false
|
||||
short_description: Co-Speech Gesture Video Generation
|
||||
license: cc-by-nc-4.0
|
||||
suggested_hardware: zero-a10g
|
||||
---
|
||||
|
||||
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
||||
@@ -1,9 +1,12 @@
|
||||
import os
|
||||
import gradio as gr
|
||||
import shutil
|
||||
from inference import tango
|
||||
import numpy as np
|
||||
|
||||
os.environ["PYOPENGL_PLATFORM"] = "osmesa"
|
||||
|
||||
from inference import tango
|
||||
|
||||
|
||||
SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
@@ -102,7 +105,6 @@ def make_demo():
|
||||
interactive=False,
|
||||
autoplay=False,
|
||||
loop=False,
|
||||
show_share_button=True,
|
||||
)
|
||||
with gr.Column(scale=4):
|
||||
video_output_2 = gr.Video(
|
||||
@@ -110,7 +112,6 @@ def make_demo():
|
||||
interactive=False,
|
||||
autoplay=False,
|
||||
loop=False,
|
||||
show_share_button=True,
|
||||
)
|
||||
with gr.Column(scale=1):
|
||||
file_output_1 = gr.File(label="Download 3D Motion and Visualize in Blender")
|
||||
|
||||
+14
-1
@@ -22,6 +22,13 @@ import smplx
|
||||
import igraph
|
||||
import fire
|
||||
|
||||
try:
|
||||
import spaces
|
||||
ZERO_GPU_AVAILABLE = True
|
||||
except ImportError:
|
||||
ZERO_GPU_AVAILABLE = False
|
||||
spaces = None
|
||||
|
||||
from utils.video_io import save_videos_from_pil
|
||||
from utils.genextend_inference_utils import adjust_statistics_to_match_reference
|
||||
from create_graph import path_visualization, graph_pruning, get_motion_reps_tensor, path_visualization_v2
|
||||
@@ -526,7 +533,13 @@ TARGET_SR = 16000
|
||||
OUTPUT_DIR = os.path.join(SCRIPT_PATH, "outputs/")
|
||||
|
||||
|
||||
# @spaces.GPU(duration=200)
|
||||
def _gpu_decorator(func):
|
||||
if ZERO_GPU_AVAILABLE and spaces is not None:
|
||||
return spaces.GPU(duration=200)(func)
|
||||
return func
|
||||
|
||||
|
||||
@_gpu_decorator
|
||||
def tango(audio_path, character_name, seed=2024, create_graph=False, video_folder_path=None):
|
||||
shutil.rmtree(OUTPUT_DIR, ignore_errors=True)
|
||||
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
ffmpeg
|
||||
libgl1-mesa-glx
|
||||
libglib2.0-0
|
||||
libsm6
|
||||
libxext6
|
||||
libxrender1
|
||||
libosmesa6-dev
|
||||
freeglut3-dev
|
||||
+8
-5
@@ -1,3 +1,5 @@
|
||||
spaces
|
||||
huggingface_hub
|
||||
gradio
|
||||
scikit-image==0.21.0
|
||||
scikit-learn==1.3.2
|
||||
@@ -10,7 +12,7 @@ opencv-python==4.8.1.78
|
||||
tensorboardx
|
||||
filterpy
|
||||
cython
|
||||
Pillow==9.5.0
|
||||
Pillow>=9.5.0
|
||||
trimesh
|
||||
pyrender
|
||||
matplotlib
|
||||
@@ -23,7 +25,7 @@ easydict
|
||||
pycocotools
|
||||
plyfile
|
||||
timm
|
||||
pyglet
|
||||
pyglet<2.0.0
|
||||
eval_type_backport
|
||||
wandb
|
||||
wget
|
||||
@@ -31,8 +33,8 @@ av==11.0.0
|
||||
ffmpeg-python
|
||||
mediapipe
|
||||
batch-face @ git+https://github.com/elliottzheng/batch-face.git@master
|
||||
decord==0.6.0
|
||||
diffusers==0.24.0
|
||||
decord
|
||||
diffusers>=0.24.0
|
||||
imageio==2.33.0
|
||||
imageio-ffmpeg==0.4.9
|
||||
omegaconf==2.2.3
|
||||
@@ -43,4 +45,5 @@ igraph
|
||||
ConfigArgParse
|
||||
librosa
|
||||
pytorch-fid
|
||||
fire
|
||||
fire
|
||||
soundfile
|
||||
Reference in New Issue
Block a user