Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ dependencies = [
"torch>=2.0.0",
"tqdm>=4.65.0",
"transformers>=4.27.4",
"setuptools",
]
description = "A semantic search CLI tool"
name = "semantra"
Expand Down
9 changes: 5 additions & 4 deletions src/semantra/semantra.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import json
import math
import os
from importlib.metadata import version

import click
import numpy as np
import pkg_resources
from dotenv import load_dotenv
from flask import Flask, jsonify, make_response, request, send_file, send_from_directory
from tqdm import tqdm
Expand All @@ -31,11 +31,12 @@
write_embedding,
)

VERSION = pkg_resources.require("semantra")[0].version
VERSION = version("semantra")
DEFAULT_ENCODING = "utf-8"
DEFAULT_PORT = 8080

package_directory = os.path.dirname(os.path.abspath(__file__))
client_public_directory = os.path.join(package_directory, "client_public")


class Content:
Expand Down Expand Up @@ -655,15 +656,15 @@ def get_content(filename):
@app.route("/")
def base():
return send_from_directory(
pkg_resources.resource_filename("semantra.semantra", "client_public"),
client_public_directory,
"index.html",
)

# Path for all the static files (compiled JS/CSS, etc.)
@app.route("/<path:path>")
def home(path):
return send_from_directory(
pkg_resources.resource_filename("semantra.semantra", "client_public"),
client_public_directory,
path,
)

Expand Down