mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 13:23:15 +00:00
Create Basic Landing Page to Query Semantic Search and Render Results
- Allow viewing image results returned by Semantic Search. Until now there wasn't any interface within the app to view image search results. For text results, we at least had the emacs interface - This should help with debugging issues with image search too For text the Swagger interface was good enough
This commit is contained in:
10
src/main.py
10
src/main.py
@@ -1,12 +1,12 @@
|
||||
# Standard Packages
|
||||
import sys, json, yaml
|
||||
import sys, json, yaml, os
|
||||
from typing import Optional
|
||||
|
||||
# External Packages
|
||||
import uvicorn
|
||||
import torch
|
||||
from fastapi import FastAPI, Request
|
||||
from fastapi.responses import HTMLResponse
|
||||
from fastapi.responses import HTMLResponse, FileResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.templating import Jinja2Templates
|
||||
|
||||
@@ -27,10 +27,16 @@ processor_config = ProcessorConfigModel()
|
||||
config_file = ""
|
||||
verbose = 0
|
||||
app = FastAPI()
|
||||
web_directory = f'src/interface/web/'
|
||||
|
||||
app.mount("/static", StaticFiles(directory=web_directory), name="static")
|
||||
app.mount("/views", StaticFiles(directory="views"), name="views")
|
||||
templates = Jinja2Templates(directory="views/")
|
||||
|
||||
@app.get("/", response_class=FileResponse)
|
||||
def index():
|
||||
return FileResponse(web_directory + "index.html")
|
||||
|
||||
@app.get('/ui', response_class=HTMLResponse)
|
||||
def ui(request: Request):
|
||||
return templates.TemplateResponse("config.html", context={'request': request})
|
||||
|
||||
Reference in New Issue
Block a user