Spaces:
Build error
Build error
Update generate.py
Browse files1234567# generate.py# --- VERSION 10 (with Upscaling) ---print("--- RUNNING GENERATE.PY VERSION 10 (with Upscaling) ---")import torchimport cv21234567891011121314151617181920# generate.py# --- VERSION 11 (with Monkey-Patch) ---print("--- RUNNING GENERATE.PY VERSION 11 (with Monkey-Patch) ---")# --- MONKEY-PATCH FOR OLD TORCHVISION ---# This block fixes the "ModuleNotFoundError" by tricking the system.# It tells any library looking for the new `functional_tensor` module# to use the old `functional` module instead.try:import sysimport torchvision.transforms.functional as Fsys.modules['torchvision.transforms.functional_tensor'] = Fprint("--- Successfully applied torchvision monkey-patch. ---")except Exception as e:print(f"--- Could not apply torchvision monkey-patch: {e} ---")# --- END OF PATCH ---import torchimport cv2
generate.py+16-3