minor formatting
All checks were successful
Security Scan / security (pull_request) Successful in 43s
Security Scan / dependency-check (pull_request) Successful in 45s
Test Suite / lint (pull_request) Successful in 30s
Test Suite / test (3.11) (pull_request) Successful in 1m29s
Test Suite / build (pull_request) Successful in 39s
All checks were successful
Security Scan / security (pull_request) Successful in 43s
Security Scan / dependency-check (pull_request) Successful in 45s
Test Suite / lint (pull_request) Successful in 30s
Test Suite / test (3.11) (pull_request) Successful in 1m29s
Test Suite / build (pull_request) Successful in 39s
This commit is contained in:
@@ -9,14 +9,13 @@ from .ui.callbacks.interactions import InteractionCallbacks
|
||||
|
||||
def create_app():
|
||||
import os
|
||||
|
||||
# Get the project root directory (two levels up from this file)
|
||||
project_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
||||
assets_path = os.path.join(project_root, 'assets')
|
||||
|
||||
assets_path = os.path.join(project_root, "assets")
|
||||
|
||||
app = dash.Dash(
|
||||
__name__,
|
||||
external_stylesheets=[dbc.themes.BOOTSTRAP],
|
||||
assets_folder=assets_path
|
||||
__name__, external_stylesheets=[dbc.themes.BOOTSTRAP], assets_folder=assets_path
|
||||
)
|
||||
|
||||
# Allow callbacks to components that are dynamically created in tabs
|
||||
|
@@ -558,17 +558,17 @@ class DataProcessingCallbacks:
|
||||
)
|
||||
def handle_text_input_actions(clear_clicks, load_clicks):
|
||||
from dash import ctx
|
||||
|
||||
|
||||
if not ctx.triggered:
|
||||
return no_update
|
||||
|
||||
button_id = ctx.triggered[0]['prop_id'].split('.')[0]
|
||||
|
||||
|
||||
button_id = ctx.triggered[0]["prop_id"].split(".")[0]
|
||||
|
||||
if button_id == "clear-text-btn" and clear_clicks:
|
||||
return ""
|
||||
elif button_id == "load-sample-btn" and load_clicks:
|
||||
return self._load_sample_text()
|
||||
|
||||
|
||||
return no_update
|
||||
|
||||
# Model info callback
|
||||
@@ -648,15 +648,19 @@ class DataProcessingCallbacks:
|
||||
def _load_sample_text(self):
|
||||
"""Load sample text from assets/sample-txt.md file."""
|
||||
import os
|
||||
|
||||
|
||||
try:
|
||||
# Get the project root directory (four levels up from this file)
|
||||
current_file = os.path.abspath(__file__)
|
||||
project_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(current_file)))))
|
||||
sample_file_path = os.path.join(project_root, 'assets', 'sample-txt.md')
|
||||
|
||||
project_root = os.path.dirname(
|
||||
os.path.dirname(
|
||||
os.path.dirname(os.path.dirname(os.path.dirname(current_file)))
|
||||
)
|
||||
)
|
||||
sample_file_path = os.path.join(project_root, "assets", "sample-txt.md")
|
||||
|
||||
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:
|
||||
return file.read()
|
||||
else:
|
||||
# Fallback sample text if file doesn't exist
|
||||
@@ -677,8 +681,8 @@ She finely chopped the garlic and sautéed it in two tablespoons of olive oil.
|
||||
A pinch of saffron adds a beautiful color and aroma to traditional paella.
|
||||
If the soup is too salty, add a peeled potato to absorb excess sodium.
|
||||
Let the bread dough rise for at least an hour in a warm, draft-free spot."""
|
||||
|
||||
except Exception as e:
|
||||
|
||||
except Exception:
|
||||
# Return a simple fallback if there's any error
|
||||
return "This is sample text for testing embedding generation. You can replace this with your own text."
|
||||
|
||||
|
@@ -27,7 +27,7 @@ class AppLayout:
|
||||
window.transformersPipeline = pipeline;
|
||||
console.log('✅ Transformers.js pipeline loaded globally');
|
||||
""",
|
||||
type="module"
|
||||
type="module",
|
||||
),
|
||||
],
|
||||
width=12,
|
||||
|
Reference in New Issue
Block a user