multimodalart HF Staff commited on
Commit
9e55ac3
·
1 Parent(s): f2827b6

[Admin maintenance] Support new ZeroGPU hardware (#9)

Browse files

- [Admin maintenance] Support new ZeroGPU hardware (88d6acc1e28fe61eee174886ddc50219f27028c2)

Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -1,3 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import spaces
2
  from diffusers import (
3
  StableDiffusionPipeline,
 
1
+ # ZeroGPU/Blackwell maintenance: restore HfFolder (removed from newer huggingface_hub, still
2
+ # imported by older gradio/oauth.py). Must run before `import spaces` (which imports gradio).
3
+ import huggingface_hub
4
+ if not hasattr(huggingface_hub, "HfFolder"):
5
+ class HfFolder:
6
+ @staticmethod
7
+ def get_token(): return huggingface_hub.get_token()
8
+ @staticmethod
9
+ def save_token(token): huggingface_hub.login(token)
10
+ @staticmethod
11
+ def delete_token():
12
+ try: huggingface_hub.logout()
13
+ except Exception: pass
14
+ huggingface_hub.HfFolder = HfFolder
15
  import spaces
16
  from diffusers import (
17
  StableDiffusionPipeline,