diff --git a/environment.yml b/environment.yml index ad5dbda..4e62d6e 100644 --- a/environment.yml +++ b/environment.yml @@ -1,4 +1,4 @@ -name: lmflow +name: csllm channels: - bioconda - ursky @@ -211,6 +211,5 @@ dependencies: - wheel==0.43.0 - xxhash==3.2.0 - yarl==1.8.2 - - zipp==3.15.0 - - zstandard==0.22.0 -prefix: /data1/home/hhu01/anaconda3/envs/lmflow + - zipp==3.15.0 + - zstandard==0.22.0 diff --git a/gui.py b/gui.py index 1baa2e7..6666712 100644 --- a/gui.py +++ b/gui.py @@ -28,8 +28,13 @@ def img_to_base64(img_path): return base64.b64encode(img_file.read()).decode('utf-8') # 将图像路径转换为 base64 编码 -img_base64 = img_to_base64("icon.png") -img_html = f'LMFlow' +icon_path = "icon.png" +if os.path.exists(icon_path): + img_base64 = img_to_base64(icon_path) + img_html = f'CSLLM' +else: + # 如果图标不存在,使用空的HTML + img_html = '
' MAX_BOXES = 20 @@ -102,6 +107,11 @@ class ChatbotArguments: "help": "comma-separated paths to the three model directories (synthesis_llm,method_llm,precursor_llm)" }, ) + vesta_path: Optional[str] = field( + default=None, + metadata={ + "help": "path to VESTA executable (optional, for structure visualization)" + }, ) pipeline_name = "inferencer" @@ -401,11 +411,25 @@ def visualize_structure(file): structure.to(fmt='poscar', filename=temp_file_path) # VESTA可执行文件路径(根据实际路径修改) - vesta_executable = '/VESTA-gtk3/VESTA' + # 优先使用命令行参数,其次尝试系统路径 + vesta_executable = chatbot_args.vesta_path + + if vesta_executable is None: + # 尝试使用系统PATH中的VESTA + import platform + system = platform.system() + if system == 'Windows': + vesta_executable = 'VESTA.exe' # Windows下默认名称 + elif system == 'Darwin': # macOS + vesta_executable = 'VESTA' + else: # Linux + vesta_executable = 'VESTA' # 调用VESTA命令行工具打开文件 try: subprocess.Popen([vesta_executable, temp_file_path]) + except FileNotFoundError: + return f"VESTA not found. Please install VESTA or specify the path using --vesta_path argument.", structure except Exception as e: return f"Failed to open VESTA: {str(e)}", structure @@ -418,7 +442,6 @@ def visualize_structure(file): with gr.Accordion("Model Configuration", open=False): gr.Markdown(f"Using models: {model_display_info}") - gr.Markdown(f"Combination method: {chatbot_args.combination_method}") state = gr.State([]) current_structure = gr.State(None) # 存储当前结构