任务:更新代码结构,以提高可读性和可维护性

This commit is contained in:
2026-02-27 13:05:20 +08:00
parent fed16f04e1
commit 371e31b00c
6 changed files with 476 additions and 6 deletions

14
main.py
View File

@@ -53,12 +53,22 @@ async def endpoint(body : Predictbody):
for key ,value in data.items():
temp[key] = value.get("value") or ""
res[uuid.uuid4().hex] = temp
result = None
try:
result = engine.inference(res)
except Exception as e:
result = None
return {
"feature" : data,
"predict" : engine.inference(res)
"predict" : result
}
@app.post("/feature")
async def get_feature(body : Predictbody):
return await process_single(body.content[:10000])
if __name__ == "__main__":
import asyncio