I have cloned your space do you mean deleteing these excalty? Is this the section I supposed to delete exactly from from line 6 to line 35?:
import spaces
import torch
import gradio as gr
from huggingface_hub import snapshot_download
from examples.get_examples import get_examples
from src.facerender.pirender_animate import AnimateFromCoeff_PIRender
from src.utils.preprocess import CropAndExtract
from src.test_audio2coeff import Audio2Coeff
from src.facerender.animate import AnimateFromCoeff
from src.generate_batch import get_data
from src.generate_facerender_batch import get_facerender_data
from src.utils.init_path import init_path
checkpoint_path = ‘checkpoints’
config_path = ‘src/config’
device = “cuda” if torch.cuda.is_available(
) else “mps” if platform.system() == ‘Darwin’ else “cpu”
os.environ[‘TORCH_HOME’] = checkpoint_path
snapshot_download(repo_id=‘vinthony/SadTalker-V002rc’,
local_dir=checkpoint_path, local_dir_use_symlinks=True)
def mp3_to_wav(mp3_filename, wav_filename, frame_rate):
AudioSegment.from_file(file=mp3_filename).set_frame_rate(
frame_rate).export(wav_filename, format=“wav”)
@spaces.GPU(duration=120)
def generate_video(source_image, driven_audio, preprocess=‘crop’, still_mode=False, use_enhancer=False,
batch_size=1, size=256, pose_style=0, facerender=‘facevid2vid’, exp_scale=1.0,
use_ref_video=False, ref_video=None, ref_info=None, use_idle_mode=False,
length_of_audio=0, use_blink=True, result_dir=‘./results/’):
# Initialize models and paths
sadtalker_paths = init_path(
checkpoint_path, config_path, size, False, preprocess)
audio_to_coeff = Audio2Coeff(sadtalker_paths, device)
preprocess_model = CropAndExtract(sadtalker_paths, device)
animate_from_coeff = AnimateFromCoeff(sadtalker_paths, device) if facerender == ‘facevid2vid’ and device != ‘mps’
else AnimateFromCoeff_PIRender(sadtalker_paths, device)