[Admin maintenance] Support new ZeroGPU hardware

#21
by multimodalart HF Staff - opened
Files changed (2) hide show
  1. app.py +9 -0
  2. requirements.txt +1 -2
app.py CHANGED
@@ -1,3 +1,12 @@
 
 
 
 
 
 
 
 
 
1
  import spaces
2
  import math
3
  import gradio as gr
 
1
+ import huggingface_hub
2
+ if not hasattr(huggingface_hub, "HfFolder"):
3
+ class _HfFolder:
4
+ @staticmethod
5
+ def get_token():
6
+ return huggingface_hub.get_token()
7
+ huggingface_hub.HfFolder = _HfFolder
8
+ # ^ shim MUST run before `import spaces` (which transitively imports gradio -> gradio.oauth,
9
+ # which still does `from huggingface_hub import HfFolder, whoami` -- removed in newer huggingface_hub).
10
  import spaces
11
  import math
12
  import gradio as gr
requirements.txt CHANGED
@@ -1,7 +1,6 @@
1
- --extra-index-url https://download.pytorch.org/whl/cu121
2
  torch
3
  diffusers==0.38.0
4
- transformers==4.36.2
5
  opencv-python
6
  safetensors
7
  pillow==10.2.0
 
 
1
  torch
2
  diffusers==0.38.0
3
+ transformers>=4.46.0
4
  opencv-python
5
  safetensors
6
  pillow==10.2.0