-
Hi. Thanks for the wonderful project. Is it possible to directly deploy I guess it's possible to do it via I tried to deploy |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Love the idea! Not sure how well you can expose a RestAPI on huggingface spaces. I would follow this Guide - effectivley you need to use Gradio and not FastAPI (my guess) https://www.tomsoderlund.com/ai/building-ai-powered-rest-api I would default to the Python API (example below), then add a RestAPI later import asyncio
from infinity_emb import AsyncEmbeddingEngine, EngineArgs
engine = AsyncEmbeddingEngine.from_args(EngineArgs(model_name_or_path = "BAAI/bge-small-en-v1.5", engine="torch"))
async def main(sentences = ("Embed this is sentence via Infinity.", "Paris is in France.")):
async with engine: # engine starts with engine.astart()
embeddings, usage = await engine.embed(sentences=sentences)
# engine stops with engine.astop()
# call the function from any async func or from asyncio.run()
asyncio.run(main()) |
Beta Was this translation helpful? Give feedback.
-
I came across this: https://medium.com/@dahmanihichem01/mixtral-and-rest-api-turning-mixtral-8x7b-into-an-api-using-huggingface-spaces-a8b150b47246 and https://huggingface.co/spaces/iiced/mixtral-46.7b-fastapi, which appears to be serving FastAPI directly from uvicorn (without using https://huggingface.co/spaces/iiced/mixtral-46.7b-fastapi/blob/main/main.py has
while `https://github.com/michaelfeil/infinity/blob/main/libs/infinity_emb/infinity_emb/infinity_server.py has:
Since |
Beta Was this translation helpful? Give feedback.
-
Just a plain Have a look at https://huggingface.co/spaces/mikeee/emb384/tree/main: Dockerfile, reuqirements.txt and start-infinity-emb.sh requirements.txt (a single line |
Beta Was this translation helpful? Give feedback.
It works! For example, Swagger UI is at https://mikeee-emb384.hf.space/docs
All we need to know is the direct url: https://{hf-usernam}-{space-name}.hf.space.