Spaces:
Sleeping
Sleeping
"""FastAPI server for open-text-embeddings. | |
To run this example: | |
```bash | |
pip install -r --no-cache-dir server-requirements.txt | |
``` | |
Then run: | |
``` | |
MODEL=intfloat/e5-large-v2 python -m open.text.embeddings.server | |
``` | |
Then visit http://localhost:8000/docs to see the interactive API docs. | |
""" | |
import uvicorn | |
from fastapi.responses import HTMLResponse | |
from open.text.embeddings.server.app import create_app | |
import os | |
app = create_app() | |
# Read the content of index.html once and store it in memory | |
with open("index.html", "r") as f: | |
content = f.read() | |
async def read_items(): | |
return content | |
if __name__ == "__main__": | |
uvicorn.run(app, | |
host=os.environ["HOST"], | |
port=int(os.environ["PORT"]) | |
) | |