Add CORS; revert back to previous index as it timed out deploying

This commit is contained in:
Daoud Clarke 2022-01-03 18:31:03 +00:00
parent 25918e42ef
commit a41088ca9a
2 changed files with 10 additions and 2 deletions

View File

@ -8,5 +8,5 @@ server_config:
index_config:
index_path: data/index.tinysearch
num_pages: 256000
page_size: 40960
num_pages: 25600
page_size: 4096

View File

@ -5,6 +5,7 @@ from pathlib import Path
from urllib.parse import urlparse
from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware
from starlette.responses import FileResponse
from starlette.staticfiles import StaticFiles
@ -20,6 +21,13 @@ SCORE_THRESHOLD = 0.25
def create(tiny_index: TinyIndex):
app = FastAPI()
# Allow CORS requests from any site
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_headers=["*"],
)
@app.get("/search")
def search(s: str):