修复interactive viewer中的metadata配置和列名问题
1. 在metadata中添加database.load配置,确保前端能正确加载数据到DuckDB 2. 将neighbors列名从'neighbors'改为'__neighbors'以符合embedding-atlas标准 3. 更新launch_interactive_viewer和visualize_csv_comparison函数中的相关配置
This commit is contained in:
@@ -20,13 +20,17 @@ def launch_interactive_viewer(df: pd.DataFrame, text_column: str, port: int = 50
|
|||||||
from embedding_atlas.utils import Hasher
|
from embedding_atlas.utils import Hasher
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
# 创建metadata
|
# 创建metadata - 添加database配置
|
||||||
metadata = {
|
metadata = {
|
||||||
"columns": {
|
"columns": {
|
||||||
"id": "_row_index",
|
"id": "_row_index",
|
||||||
"text": text_column,
|
"text": text_column,
|
||||||
"embedding": {"x": "projection_x", "y": "projection_y"},
|
"embedding": {"x": "projection_x", "y": "projection_y"},
|
||||||
"neighbors": "neighbors"
|
"neighbors": "__neighbors" # 使用双下划线
|
||||||
|
},
|
||||||
|
"database": {
|
||||||
|
"type": "wasm",
|
||||||
|
"load": True # 关键: 告诉前端加载数据
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +113,7 @@ def create_embedding_service(
|
|||||||
text=text_column,
|
text=text_column,
|
||||||
x="projection_x",
|
x="projection_x",
|
||||||
y="projection_y",
|
y="projection_y",
|
||||||
neighbors="neighbors",
|
neighbors="__neighbors", # 改为双下划线
|
||||||
model=model,
|
model=model,
|
||||||
batch_size=batch_size,
|
batch_size=batch_size,
|
||||||
umap_args=umap_args
|
umap_args=umap_args
|
||||||
@@ -234,7 +238,7 @@ def visualize_csv_comparison(
|
|||||||
text=text_column,
|
text=text_column,
|
||||||
x="projection_x",
|
x="projection_x",
|
||||||
y="projection_y",
|
y="projection_y",
|
||||||
neighbors="neighbors",
|
neighbors="__neighbors", # 改为双下划线
|
||||||
model=model,
|
model=model,
|
||||||
batch_size=batch_size,
|
batch_size=batch_size,
|
||||||
umap_args=umap_args
|
umap_args=umap_args
|
||||||
@@ -298,11 +302,11 @@ def main():
|
|||||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||||
epilog="""
|
epilog="""
|
||||||
Examples:
|
Examples:
|
||||||
python visualize_csv_comparison.py file1.csv file2.csv
|
python -m visualization.comparison file1.csv file2.csv
|
||||||
python visualize_csv_comparison.py file1.csv file2.csv --column1 smiles --column2 SMILES
|
python -m visualization.comparison file1.csv file2.csv --column1 smiles --column2 SMILES
|
||||||
python visualize_csv_comparison.py file1.csv file2.csv --label1 "Dataset A" --label2 "Dataset B"
|
python -m visualization.comparison file1.csv file2.csv --label1 "Dataset A" --label2 "Dataset B"
|
||||||
python visualize_csv_comparison.py file1.csv file2.csv --output comparison.png
|
python -m visualization.comparison file1.csv file2.csv --output comparison.png
|
||||||
python visualize_csv_comparison.py file1.csv file2.csv --interactive --port 8080
|
python -m visualization.comparison file1.csv file2.csv --interactive --port 8080
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user