Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfeil committed Dec 10, 2024
1 parent c335df8 commit edd9107
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions libs/infinity_emb/infinity_emb/infinity_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,21 +354,27 @@ def url_to_base64(url, modality = "image"):
"[📝] Received request with %s input texts ",
len(input_), # type: ignore
)
embedding, usage = await engine.embed(sentences=input_,matryoshka_dim=data_root.dimensions)
embedding, usage = await engine.embed(
sentences=input_, matryoshka_dim=data_root.dimensions
)
elif modality == Modality.audio:
urls_or_bytes = _resolve_mixed_input(data_root.input) # type: ignore
logger.debug(
"[📝] Received request with %s input audios ",
len(urls_or_bytes), # type: ignore
)
embedding, usage = await engine.audio_embed(audios=urls_or_bytes,matryoshka_dim=data_root.dimensions)
embedding, usage = await engine.audio_embed(
audios=urls_or_bytes, matryoshka_dim=data_root.dimensions
)
elif modality == Modality.image:
urls_or_bytes = _resolve_mixed_input(data_root.input) # type: ignore
logger.debug(
"[📝] Received request with %s input images ",
len(urls_or_bytes), # type: ignore
)
embedding, usage = await engine.image_embed(images=urls_or_bytes,matryoshka_dim=data_root.dimensions)
embedding, usage = await engine.image_embed(
images=urls_or_bytes, matryoshka_dim=data_root.dimensions
)

duration = (time.perf_counter() - start) * 1000
logger.debug("[✅] Done in %s ms", duration)
Expand Down

0 comments on commit edd9107

Please sign in to comment.