Hunsain Mazhar commited on
Commit
3358f3e
Β·
1 Parent(s): d055370

Add monkey patch for diffusers 0.25 compatibility with huggingface_hub; prevent crashes on import.

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -3,6 +3,15 @@ import os
3
  import gc
4
  import shutil
5
 
 
 
 
 
 
 
 
 
 
6
  # --- 1. System Setup & Error Handling ---
7
  # Force install detectron2 if missing
8
  try:
 
3
  import gc
4
  import shutil
5
 
6
+
7
+ # --- MONKEY PATCH: Fix for diffusers 0.25 vs huggingface_hub ---
8
+ import huggingface_hub
9
+ if not hasattr(huggingface_hub, "cached_download"):
10
+ # Create a dummy alias so diffusers 0.25.1 doesn't crash on import
11
+ huggingface_hub.cached_download = huggingface_hub.hf_hub_download
12
+ # ---------------------------------------------------------------
13
+
14
+ # Now continue with normal imports...
15
  # --- 1. System Setup & Error Handling ---
16
  # Force install detectron2 if missing
17
  try: