Muhammad Taqi Raza commited on
Commit
1fbb5db
·
1 Parent(s): 987bf72

GPU setting

Browse files
Files changed (1) hide show
  1. gradio_app.py +3 -0
gradio_app.py CHANGED
@@ -12,6 +12,7 @@ HF_HOME = "/home/user/app/hf_cache"
12
  os.environ["HF_HOME"] = HF_HOME
13
  os.environ["TRANSFORMERS_CACHE"] = HF_HOME
14
  os.makedirs(HF_HOME, exist_ok=True)
 
15
 
16
  # hf_hub_download(repo_id="ai-forever/Real-ESRGAN", filename="RealESRGAN_x4.pth", local_dir="model_real_esran")
17
  # snapshot_download(repo_id="AlexWortega/RIFE", local_dir="model_rife")
@@ -39,6 +40,7 @@ def download_models():
39
  # -----------------------------
40
  # Step 1: Get Anchor Video
41
  # -----------------------------
 
42
  def get_anchor_video(video_path, fps, num_frames, target_pose, mode,
43
  radius_scale, near_far_estimated,
44
  sampler_name, diffusion_guidance_scale, diffusion_inference_steps,
@@ -110,6 +112,7 @@ def get_anchor_video(video_path, fps, num_frames, target_pose, mode,
110
  # -----------------------------
111
  # Step 2: Run Inference
112
  # -----------------------------
 
113
  def inference(
114
  fps, num_frames, controlnet_weights, controlnet_guidance_start,
115
  controlnet_guidance_end, guidance_scale, num_inference_steps, dtype,
 
12
  os.environ["HF_HOME"] = HF_HOME
13
  os.environ["TRANSFORMERS_CACHE"] = HF_HOME
14
  os.makedirs(HF_HOME, exist_ok=True)
15
+ from spaces import GPU
16
 
17
  # hf_hub_download(repo_id="ai-forever/Real-ESRGAN", filename="RealESRGAN_x4.pth", local_dir="model_real_esran")
18
  # snapshot_download(repo_id="AlexWortega/RIFE", local_dir="model_rife")
 
40
  # -----------------------------
41
  # Step 1: Get Anchor Video
42
  # -----------------------------
43
+ @GPU
44
  def get_anchor_video(video_path, fps, num_frames, target_pose, mode,
45
  radius_scale, near_far_estimated,
46
  sampler_name, diffusion_guidance_scale, diffusion_inference_steps,
 
112
  # -----------------------------
113
  # Step 2: Run Inference
114
  # -----------------------------
115
+ @GPU
116
  def inference(
117
  fps, num_frames, controlnet_weights, controlnet_guidance_start,
118
  controlnet_guidance_end, guidance_scale, num_inference_steps, dtype,