任务:更新代码结构,以提高可读性和可维护性
This commit is contained in:
14
main.py
14
main.py
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user