WACATW commited on
Commit
b28937d
·
verified ·
1 Parent(s): 12387e8

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -38
app.py DELETED
@@ -1,38 +0,0 @@
1
- """Hugging Face Space 入口(SDK: Gradio + ZeroGPU,业务由 FastAPI 提供)
2
-
3
- ZeroGPU 平台检测:启动时需存在 @spaces.GPU 装饰函数,且应用需包含
4
- Gradio 应用。本文件提供占位 GPU 函数与 Gradio Blocks;真正的业务
5
- (前端页面 + /api/*)由 FastAPI 应用 main.app 提供。
6
-
7
- 合并方式(参考 ZeroGPU 生产案例):
8
- app = gr.mount_gradio_app(cc_app, demo, path="/gradio")
9
- 即 FastAPI 为主应用,Gradio 作为子应用挂到 /gradio 占位路径;
10
- 根路径 / 与 /api/* 全部由业务 FastAPI 响应,最后用 uvicorn 启动。
11
-
12
- _gpu_probe 仅为满足平台检测,业务从不调用,不消耗 GPU 免费配额。
13
- """
14
- import os
15
-
16
- import gradio as gr
17
- import spaces # noqa: F401 (ZeroGPU 镜像自带)
18
-
19
- from main import app as cc_app
20
-
21
-
22
- @spaces.GPU
23
- def _gpu_probe(): # ZeroGPU 平台检测占位函数(业务不调用)
24
- return "ok"
25
-
26
-
27
- with gr.Blocks() as demo:
28
- gr.Markdown("云端相机")
29
-
30
- demo.queue()
31
-
32
- # 合并应用:FastAPI 为主,Gradio 挂载到 /gradio(ZeroGPU 平台要求含 Gradio 应用)
33
- app = gr.mount_gradio_app(cc_app, demo, path="/gradio")
34
-
35
- if __name__ == "__main__":
36
- import uvicorn
37
- port = int(os.environ.get("PORT", "7860"))
38
- uvicorn.run(app, host="0.0.0.0", port=port)