donotthink commited on
Commit
aa348d3
·
verified ·
1 Parent(s): d217db3

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -106,6 +106,14 @@ if _font_src.exists():
106
  shutil.copy2(_f, _font_dst / _f.name)
107
  subprocess.run(["fc-cache", "-fv"], capture_output=True)
108
 
 
 
 
 
 
 
 
 
109
  # ---- 启动 meme_generator 原生 FastAPI(无 Gradio,无 CSRF)----
110
  import uvicorn
111
  from meme_generator.app import app, register_routers
 
106
  shutil.copy2(_f, _font_dst / _f.name)
107
  subprocess.run(["fc-cache", "-fv"], capture_output=True)
108
 
109
+ # ---- ZeroGPU 兼容层:必须有 @spaces.GPU 装饰的函数,否则 ZeroGPU 会停止应用 ----
110
+ import spaces
111
+
112
+ @spaces.GPU
113
+ def _zero_gpu_warmup():
114
+ """占位函数,让 ZeroGPU 检测到 GPU 函数。实际不使用 GPU。"""
115
+ return None
116
+
117
  # ---- 启动 meme_generator 原生 FastAPI(无 Gradio,无 CSRF)----
118
  import uvicorn
119
  from meme_generator.app import app, register_routers