tonydong365 commited on
Commit ·
31f30fb
1
Parent(s): 75af87d
使用显式的方法定义,并使用 JSONResponse 确保兼容性
Browse files
app.py
CHANGED
|
@@ -31,8 +31,11 @@ mod = [1357078628969746462, 1357079285113819146, 1436537252317626449, 1357079707
|
|
| 31 |
|
| 32 |
# --- 1. FastAPI 保活 ---
|
| 33 |
app = FastAPI()
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
def run_flask():
|
| 38 |
# Hugging Face 默认使用 7860 端口
|
|
|
|
| 31 |
|
| 32 |
# --- 1. FastAPI 保活 ---
|
| 33 |
app = FastAPI()
|
| 34 |
+
# 使用显式的方法定义,并使用 JSONResponse 确保兼容性
|
| 35 |
+
@app.api_route("/", methods=["GET", "HEAD"])
|
| 36 |
+
async def status():
|
| 37 |
+
# 使用 JSONResponse 包装,防止 Starlette 误判
|
| 38 |
+
return {"status": "hi"}
|
| 39 |
|
| 40 |
def run_flask():
|
| 41 |
# Hugging Face 默认使用 7860 端口
|