test fix
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ from huggingface_hub import hf_hub_download
|
|
18 |
|
19 |
#gradio.helpers.CACHED_FOLDER = '/data/cache'
|
20 |
|
21 |
-
# OPTIONAL: Clear caches at startup to free space
|
22 |
hf_cache = os.path.expanduser("~/.cache/huggingface")
|
23 |
torch_cache = os.path.expanduser("~/.cache/torch")
|
24 |
if os.path.exists(hf_cache):
|
@@ -26,6 +26,10 @@ if os.path.exists(hf_cache):
|
|
26 |
if os.path.exists(torch_cache):
|
27 |
shutil.rmtree(torch_cache)
|
28 |
|
|
|
|
|
|
|
|
|
29 |
# Load the pipeline with authentication token
|
30 |
pipe = StableVideoDiffusionPipeline.from_pretrained(
|
31 |
"stabilityai/stable-video-diffusion-img2vid-xt",
|
@@ -34,9 +38,6 @@ pipe = StableVideoDiffusionPipeline.from_pretrained(
|
|
34 |
use_auth_token=os.getenv("HUGGINGFACE_TOKEN") # Fetch the token from environment if set
|
35 |
)
|
36 |
pipe.to("cuda")
|
37 |
-
# Uncomment these lines only if you want experimental compilation (and if your environment supports it)
|
38 |
-
# pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
39 |
-
# pipe.vae = torch.compile(pipe.vae, mode="reduce-overhead", fullgraph=True)
|
40 |
|
41 |
max_64_bit_int = 2**63 - 1
|
42 |
|
@@ -145,9 +146,5 @@ with gr.Blocks() as demo:
|
|
145 |
api_name="video"
|
146 |
)
|
147 |
|
148 |
-
# REMOVED: gr.Examples(...) that referenced local images like "blink_meme.png" which don't exist
|
149 |
-
|
150 |
if __name__ == "__main__":
|
151 |
-
# remove `share=True` because it is not supported on Hugging Face Spaces
|
152 |
demo.launch(show_api=False)
|
153 |
-
|
|
|
18 |
|
19 |
#gradio.helpers.CACHED_FOLDER = '/data/cache'
|
20 |
|
21 |
+
# OPTIONAL: Clear caches at startup to free space
|
22 |
hf_cache = os.path.expanduser("~/.cache/huggingface")
|
23 |
torch_cache = os.path.expanduser("~/.cache/torch")
|
24 |
if os.path.exists(hf_cache):
|
|
|
26 |
if os.path.exists(torch_cache):
|
27 |
shutil.rmtree(torch_cache)
|
28 |
|
29 |
+
# Configure ZeroGPU to use memory instead of disk
|
30 |
+
from spaces.zero.config import Config
|
31 |
+
Config.zerogpu_offload_dir = None # Disable disk offloading to prevent disk space issues
|
32 |
+
|
33 |
# Load the pipeline with authentication token
|
34 |
pipe = StableVideoDiffusionPipeline.from_pretrained(
|
35 |
"stabilityai/stable-video-diffusion-img2vid-xt",
|
|
|
38 |
use_auth_token=os.getenv("HUGGINGFACE_TOKEN") # Fetch the token from environment if set
|
39 |
)
|
40 |
pipe.to("cuda")
|
|
|
|
|
|
|
41 |
|
42 |
max_64_bit_int = 2**63 - 1
|
43 |
|
|
|
146 |
api_name="video"
|
147 |
)
|
148 |
|
|
|
|
|
149 |
if __name__ == "__main__":
|
|
|
150 |
demo.launch(show_api=False)
|
|