diff --git a/.gitignore b/.gitignore index a4b8d2d6..c763b375 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ __pycache__ .emacs.desktop* tests/data/.* src/.data -.vscode \ No newline at end of file +.vscode +*.gz +*.pt \ No newline at end of file diff --git a/config.yml b/config.yml new file mode 100644 index 00000000..ef75c19f --- /dev/null +++ b/config.yml @@ -0,0 +1,32 @@ +content-type: + org: + input-files: ["/home/saba/notes/notes.org", "/home/saba/notes/writing.org"] + input-filter: null + compressed-jsonl: ".notes.json.gz" + embeddings-file: ".note_embeddings.pt" + + # ledger: + # input-files: /home/projects/personal-finance/bon.beancount + # input-filter: null + # compressed-jsonl: .transactions.jsonl.gz + # embeddings-file: .transaction_embeddings.pt + + # image: + # input-directory: "tests/data" + # embeddings-file: "tests/data/.image_embeddings.pt" + # batch-size: 50 + # use-xmp-metadata: "no" + + # music: + # input-files: ["tests/data/music.org"] + # input-filter: null + # compressed-jsonl: "tests/data/.songs.jsonl.gz" + # embeddings-file: "tests/data/.song_embeddings.pt" + +search-type: + asymmetric: + encoder: "sentence-transformers/msmarco-MiniLM-L-6-v3" + cross-encoder: "cross-encoder/ms-marco-MiniLM-L-6-v2" + + image: + encoder: "clip-ViT-B-32" diff --git a/src/main.py b/src/main.py index bf2f819f..63c291e1 100644 --- a/src/main.py +++ b/src/main.py @@ -4,7 +4,9 @@ from typing import Optional # External Packages import uvicorn -from fastapi import FastAPI +from fastapi import FastAPI, Request +from fastapi.responses import HTMLResponse +from fastapi.templating import Jinja2Templates # Internal Packages from src.search_type import asymmetric, symmetric_ledger, image_search @@ -12,12 +14,17 @@ from src.utils.helpers import get_from_dict from src.utils.cli import cli from src.utils.config import SearchType, SearchModels, TextSearchConfig, ImageSearchConfig, SearchConfig - # Application Global State model = SearchModels() search_config = SearchConfig() app = FastAPI() +# app.mount("/views", StaticFiles(directory="./views"), name="views") +templates = Jinja2Templates(directory="views/") + +@app.get('/ui', response_class=HTMLResponse) +def ui(request: Request): + return templates.TemplateResponse("config.html", context={'request': request}) @app.get('/search') def search(q: str, n: Optional[int] = 5, t: Optional[SearchType] = None): diff --git a/views/config.html b/views/config.html new file mode 100644 index 00000000..23133932 --- /dev/null +++ b/views/config.html @@ -0,0 +1,28 @@ + + + Set directories for your config file. + + +
+ +

Org notes

+ + + + +
+ + + \ No newline at end of file