Muhammad Taqi Raza
commited on
Commit
·
6b300d2
1
Parent(s):
1fbb5db
GPU setting
Browse files- gradio_app.py +4 -3
gradio_app.py
CHANGED
@@ -5,6 +5,8 @@ from pathlib import Path
|
|
5 |
import gradio as gr
|
6 |
import numpy as np
|
7 |
import os
|
|
|
|
|
8 |
# -----------------------------
|
9 |
# Setup paths and env
|
10 |
# -----------------------------
|
@@ -12,7 +14,6 @@ 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 |
-
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,7 +41,7 @@ def download_models():
|
|
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,7 +113,7 @@ def get_anchor_video(video_path, fps, num_frames, target_pose, mode,
|
|
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,
|
|
|
5 |
import gradio as gr
|
6 |
import numpy as np
|
7 |
import os
|
8 |
+
from huggingface_hub import spaces
|
9 |
+
|
10 |
# -----------------------------
|
11 |
# Setup paths and env
|
12 |
# -----------------------------
|
|
|
14 |
os.environ["HF_HOME"] = HF_HOME
|
15 |
os.environ["TRANSFORMERS_CACHE"] = HF_HOME
|
16 |
os.makedirs(HF_HOME, exist_ok=True)
|
|
|
17 |
|
18 |
# hf_hub_download(repo_id="ai-forever/Real-ESRGAN", filename="RealESRGAN_x4.pth", local_dir="model_real_esran")
|
19 |
# snapshot_download(repo_id="AlexWortega/RIFE", local_dir="model_rife")
|
|
|
41 |
# -----------------------------
|
42 |
# Step 1: Get Anchor Video
|
43 |
# -----------------------------
|
44 |
+
@spaces.GPU
|
45 |
def get_anchor_video(video_path, fps, num_frames, target_pose, mode,
|
46 |
radius_scale, near_far_estimated,
|
47 |
sampler_name, diffusion_guidance_scale, diffusion_inference_steps,
|
|
|
113 |
# -----------------------------
|
114 |
# Step 2: Run Inference
|
115 |
# -----------------------------
|
116 |
+
@spaces.GPU
|
117 |
def inference(
|
118 |
fps, num_frames, controlnet_weights, controlnet_guidance_start,
|
119 |
controlnet_guidance_end, guidance_scale, num_inference_steps, dtype,
|