fix: Face processor now saves status and total_faces to face.json

This commit is contained in:
Accusys
2026-09-26 23:06:11 +08:00
parent 8a736a4103
commit 357e585399
99 changed files with 13881 additions and 1065 deletions
+17
View File
@@ -39,6 +39,7 @@ def embed(texts: list[str]) -> list[list[float]]:
@app.route("/v1/embeddings", methods=["POST"])
def embeddings():
start_time = time.time()
data = request.get_json()
texts = data.get("input", [])
if isinstance(texts, str):
@@ -46,10 +47,26 @@ def embeddings():
if not texts:
return jsonify({"error": "empty input"}), 400
try:
# Tokenize to get token count
inputs = TOKENIZER(texts, padding=True, truncation=True, return_tensors="pt")
total_tokens = inputs["input_ids"].shape[1] * len(texts)
# Generate embeddings
emb = embed(texts)
duration_ms = int((time.time() - start_time) * 1000)
result = {
"data": [{"embedding": e, "index": i} for i, e in enumerate(emb)],
"model": "embeddinggemma-300m",
"usage": {
"prompt_tokens": total_tokens,
"completion_tokens": 0,
"total_tokens": total_tokens
},
"timings": {
"duration_ms": duration_ms
}
}
return jsonify(result)
except Exception as e: