Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
9c39b848f0 | |||
|
6b6735e07f | ||
4b99f2e816 | |||
|
c38f8f2ef8 | ||
478dc3a8a1 | |||
|
2d4bc5fa2f | ||
291bf9473a | |||
|
d30387e201 | ||
63df27b480 | |||
68f5cf8617 |
@@ -23,7 +23,6 @@ COPY pyproject.toml uv.lock ./
|
|||||||
|
|
||||||
# Copy source code (needed for editable install)
|
# Copy source code (needed for editable install)
|
||||||
COPY src/ src/
|
COPY src/ src/
|
||||||
COPY assets/ assets/
|
|
||||||
|
|
||||||
# Change ownership of source files before building (lighter I/O)
|
# Change ownership of source files before building (lighter I/O)
|
||||||
RUN chown -R appuser:appuser /app
|
RUN chown -R appuser:appuser /app
|
||||||
@@ -56,7 +55,6 @@ RUN chown appuser:appuser /app
|
|||||||
# Copy files from builder with correct ownership
|
# Copy files from builder with correct ownership
|
||||||
COPY --from=builder --chown=appuser:appuser /app/.venv /app/.venv
|
COPY --from=builder --chown=appuser:appuser /app/.venv /app/.venv
|
||||||
COPY --from=builder --chown=appuser:appuser /app/src /app/src
|
COPY --from=builder --chown=appuser:appuser /app/src /app/src
|
||||||
COPY --from=builder --chown=appuser:appuser /app/assets /app/assets
|
|
||||||
|
|
||||||
# Switch to non-root user
|
# Switch to non-root user
|
||||||
USER appuser
|
USER appuser
|
||||||
|
16
README.md
16
README.md
@@ -28,6 +28,10 @@ documents and prompts to understand how queries relate to your content.
|
|||||||
- **Sidebar layout** with controls on left, large visualization area on right
|
- **Sidebar layout** with controls on left, large visualization area on right
|
||||||
- **Real-time visualization** optimized for small to medium datasets
|
- **Real-time visualization** optimized for small to medium datasets
|
||||||
|
|
||||||
|
## Network Dependency
|
||||||
|
|
||||||
|
**Note:** The application loads the Transformers.js library (v3.0.0) from `cdn.jsdelivr.net` for client-side embedding generation. This requires an active internet connection and sends requests to a third-party CDN. The application will function without internet if you only use the file upload features for pre-computed embeddings.
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
@@ -64,6 +68,18 @@ docker run -p 8050:8050 ghcr.io/godber/embedding-buddy:latest
|
|||||||
|
|
||||||
The application will be available at <http://127.0.0.1:8050>
|
The application will be available at <http://127.0.0.1:8050>
|
||||||
|
|
||||||
|
### macOS Installation Notes
|
||||||
|
|
||||||
|
If installation fails with C++ compiler or library errors (common with `opentsne`), install Xcode Command Line Tools:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install or update Command Line Tools
|
||||||
|
xcode-select --install
|
||||||
|
|
||||||
|
# Or reset existing installation
|
||||||
|
sudo xcode-select --reset
|
||||||
|
```
|
||||||
|
|
||||||
### Using the Application
|
### Using the Application
|
||||||
|
|
||||||
1. **Open your browser** to <http://127.0.0.1:8050>
|
1. **Open your browser** to <http://127.0.0.1:8050>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "embeddingbuddy"
|
name = "embeddingbuddy"
|
||||||
version = "0.7.0"
|
version = "0.8.3"
|
||||||
description = "A Python Dash application for interactive exploration and visualization of embedding vectors through dimensionality reduction techniques."
|
description = "A Python Dash application for interactive exploration and visualization of embedding vectors through dimensionality reduction techniques."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
@@ -54,3 +54,6 @@ where = ["src"]
|
|||||||
|
|
||||||
[tool.setuptools.package-dir]
|
[tool.setuptools.package-dir]
|
||||||
"" = "src"
|
"" = "src"
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
embeddingbuddy = ["assets/**/*"]
|
||||||
|
@@ -16,16 +16,15 @@ def create_app():
|
|||||||
from .ui.callbacks.visualization import VisualizationCallbacks
|
from .ui.callbacks.visualization import VisualizationCallbacks
|
||||||
from .ui.callbacks.interactions import InteractionCallbacks
|
from .ui.callbacks.interactions import InteractionCallbacks
|
||||||
|
|
||||||
# Get the project root directory (two levels up from this file)
|
# Get the assets directory relative to this module
|
||||||
project_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
module_dir = os.path.dirname(__file__)
|
||||||
assets_path = os.path.join(project_root, "assets")
|
assets_path = os.path.join(module_dir, "assets")
|
||||||
|
|
||||||
app = dash.Dash(
|
app = dash.Dash(
|
||||||
__name__,
|
__name__,
|
||||||
title="EmbeddingBuddy",
|
title="EmbeddingBuddy",
|
||||||
external_stylesheets=[
|
external_stylesheets=[
|
||||||
dbc.themes.BOOTSTRAP,
|
dbc.themes.BOOTSTRAP,
|
||||||
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css",
|
|
||||||
],
|
],
|
||||||
assets_folder=assets_path,
|
assets_folder=assets_path,
|
||||||
meta_tags=[
|
meta_tags=[
|
||||||
@@ -168,8 +167,15 @@ def serve(host=None, port=None, dev=False, debug=False):
|
|||||||
|
|
||||||
# Only print startup messages in main process (not in Flask reloader)
|
# Only print startup messages in main process (not in Flask reloader)
|
||||||
if not os.environ.get("WERKZEUG_RUN_MAIN"):
|
if not os.environ.get("WERKZEUG_RUN_MAIN"):
|
||||||
|
from importlib.metadata import version
|
||||||
|
|
||||||
|
try:
|
||||||
|
pkg_version = version("embeddingbuddy")
|
||||||
|
except Exception:
|
||||||
|
pkg_version = "unknown"
|
||||||
|
|
||||||
mode = "development" if dev else ("debug" if debug else "production")
|
mode = "development" if dev else ("debug" if debug else "production")
|
||||||
print(f"Starting EmbeddingBuddy in {mode} mode...")
|
print(f"Starting EmbeddingBuddy v{pkg_version} in {mode} mode...")
|
||||||
print("Loading dependencies (this may take a few seconds)...")
|
print("Loading dependencies (this may take a few seconds)...")
|
||||||
print(f"Server will start at http://{actual_host}:{actual_port}")
|
print(f"Server will start at http://{actual_host}:{actual_port}")
|
||||||
if use_reloader:
|
if use_reloader:
|
||||||
|
2
src/embeddingbuddy/assets/fontawesome.css
vendored
Normal file
2
src/embeddingbuddy/assets/fontawesome.css
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/* Load Font Awesome from local assets */
|
||||||
|
@import url("/assets/fontawesome/css/all.min.css");
|
165
src/embeddingbuddy/assets/fontawesome/LICENSE.txt
Normal file
165
src/embeddingbuddy/assets/fontawesome/LICENSE.txt
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
Fonticons, Inc. (https://fontawesome.com)
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Font Awesome Free License
|
||||||
|
|
||||||
|
Font Awesome Free is free, open source, and GPL friendly. You can use it for
|
||||||
|
commercial projects, open source projects, or really almost whatever you want.
|
||||||
|
Full Font Awesome Free license: https://fontawesome.com/license/free.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/)
|
||||||
|
|
||||||
|
The Font Awesome Free download is licensed under a Creative Commons
|
||||||
|
Attribution 4.0 International License and applies to all icons packaged
|
||||||
|
as SVG and JS file types.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Fonts: SIL OFL 1.1 License
|
||||||
|
|
||||||
|
In the Font Awesome Free download, the SIL OFL license applies to all icons
|
||||||
|
packaged as web and desktop font files.
|
||||||
|
|
||||||
|
Copyright (c) 2023 Fonticons, Inc. (https://fontawesome.com)
|
||||||
|
with Reserved Font Name: "Font Awesome".
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
This license is copied below, and is also available with a FAQ at:
|
||||||
|
http://scripts.sil.org/OFL
|
||||||
|
|
||||||
|
SIL OPEN FONT LICENSE
|
||||||
|
Version 1.1 - 26 February 2007
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||||
|
development of collaborative font projects, to support the font creation
|
||||||
|
efforts of academic and linguistic communities, and to provide a free and
|
||||||
|
open framework in which fonts may be shared and improved in partnership
|
||||||
|
with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply
|
||||||
|
to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this license and clearly marked as such. This may
|
||||||
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
|
copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components as
|
||||||
|
distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting — in part or in whole — any of the components of the
|
||||||
|
Original Version, by changing formats or by porting the Font Software to a
|
||||||
|
new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical
|
||||||
|
writer or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
PERMISSION & CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
|
Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,
|
||||||
|
in Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
|
redistributed and/or sold with any software, provided that each copy
|
||||||
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
|
in the appropriate machine-readable metadata fields within text or
|
||||||
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the corresponding
|
||||||
|
Copyright Holder. This restriction only applies to the primary font name as
|
||||||
|
presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
|
Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole,
|
||||||
|
must be distributed entirely under this license, and must not be
|
||||||
|
distributed under any other license. The requirement for fonts to
|
||||||
|
remain under this license does not apply to any document created
|
||||||
|
using the Font Software.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are
|
||||||
|
not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Code: MIT License (https://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
In the Font Awesome Free download, the MIT license applies to all non-font and
|
||||||
|
non-icon files.
|
||||||
|
|
||||||
|
Copyright 2023 Fonticons, Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in the
|
||||||
|
Software without restriction, including without limitation the rights to use, copy,
|
||||||
|
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||||
|
and to permit persons to whom the Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Attribution
|
||||||
|
|
||||||
|
Attribution is required by MIT, SIL OFL, and CC BY licenses. Downloaded Font
|
||||||
|
Awesome Free files already contain embedded comments with sufficient
|
||||||
|
attribution, so you shouldn't need to do anything additional when using these
|
||||||
|
files normally.
|
||||||
|
|
||||||
|
We've kept attribution comments terse, so we ask that you do not actively work
|
||||||
|
to remove them from files, especially code. They're a great way for folks to
|
||||||
|
learn about Font Awesome.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Brand Icons
|
||||||
|
|
||||||
|
All brand icons are trademarks of their respective owners. The use of these
|
||||||
|
trademarks does not indicate endorsement of the trademark holder by Font
|
||||||
|
Awesome, nor vice versa. **Please do not use brand logos for any purpose except
|
||||||
|
to represent the company, product, or service to which they refer.**
|
9
src/embeddingbuddy/assets/fontawesome/css/all.min.css
vendored
Normal file
9
src/embeddingbuddy/assets/fontawesome/css/all.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
src/embeddingbuddy/assets/fontawesome/webfonts/fa-brands-400.ttf
Normal file
BIN
src/embeddingbuddy/assets/fontawesome/webfonts/fa-brands-400.ttf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
src/embeddingbuddy/assets/fontawesome/webfonts/fa-solid-900.ttf
Normal file
BIN
src/embeddingbuddy/assets/fontawesome/webfonts/fa-solid-900.ttf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -660,14 +660,12 @@ class DataProcessingCallbacks:
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Get the project root directory (four levels up from this file)
|
# Get the embeddingbuddy package directory (three levels up from this file)
|
||||||
current_file = os.path.abspath(__file__)
|
current_file = os.path.abspath(__file__)
|
||||||
project_root = os.path.dirname(
|
package_dir = os.path.dirname(
|
||||||
os.path.dirname(
|
os.path.dirname(os.path.dirname(current_file))
|
||||||
os.path.dirname(os.path.dirname(os.path.dirname(current_file)))
|
|
||||||
)
|
)
|
||||||
)
|
sample_file_path = os.path.join(package_dir, "assets", "sample-txt.md")
|
||||||
sample_file_path = os.path.join(project_root, "assets", "sample-txt.md")
|
|
||||||
|
|
||||||
if os.path.exists(sample_file_path):
|
if os.path.exists(sample_file_path):
|
||||||
with open(sample_file_path, "r", encoding="utf-8") as file:
|
with open(sample_file_path, "r", encoding="utf-8") as file:
|
||||||
|
Reference in New Issue
Block a user