Spaces:
Running
Running
from fastapi.middleware.cors import CORSMiddleware | |
from fastapi import FastAPI | |
from tasks import sentence_embeddings | |
app = FastAPI(docs_url="/", redoc_url=None) | |
# CORS Support: https://stackoverflow.com/a/66460861 | |
origins = ["*"] | |
app.add_middleware( | |
CORSMiddleware, | |
allow_origins=origins, | |
allow_credentials=True, | |
allow_methods=["*"], | |
allow_headers=["*"], | |
) | |
app.include_router(sentence_embeddings.router) | |
if __name__ == '__main__': | |
import uvicorn | |
uvicorn.run(app, host='0.0.0.0', port=8000) | |