Spaces:
Running
Running
kabudadada commited on
Commit ·
0f37a3d
1
Parent(s): 1cd49a3
fix(import): force local esm/source via sys.path & PYTHONPATH; start via script
Browse files
esm/mcp_output/mcp_plugin/mcp_service.py
CHANGED
|
@@ -5,17 +5,7 @@ source_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__fil
|
|
| 5 |
sys.path.insert(0, source_path)
|
| 6 |
|
| 7 |
from fastmcp import FastMCP
|
| 8 |
-
|
| 9 |
-
from esm import pretrained, data, inverse_folding, model # type: ignore
|
| 10 |
-
# from examples.lm_design.lm_design import lm_design
|
| 11 |
-
# from examples.variant_prediction.predict import predict
|
| 12 |
-
# from scripts import extract, fold
|
| 13 |
-
except Exception as import_error: # pragma: no cover
|
| 14 |
-
pretrained = None # type: ignore
|
| 15 |
-
data = None # type: ignore
|
| 16 |
-
inverse_folding = None # type: ignore
|
| 17 |
-
model = None # type: ignore
|
| 18 |
-
print(f"[warn] Optional ESM modules unavailable: {import_error}")
|
| 19 |
|
| 20 |
mcp = FastMCP("esm_service")
|
| 21 |
|
|
|
|
| 5 |
sys.path.insert(0, source_path)
|
| 6 |
|
| 7 |
from fastmcp import FastMCP
|
| 8 |
+
from esm import pretrained, data, inverse_folding, model # type: ignore
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
mcp = FastMCP("esm_service")
|
| 11 |
|
esm/mcp_output/start_mcp.py
CHANGED
|
@@ -5,6 +5,9 @@ MCP Service Startup Entry Point
|
|
| 5 |
import sys
|
| 6 |
import os
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
project_root = os.path.dirname(os.path.abspath(__file__))
|
| 9 |
mcp_plugin_dir = os.path.join(project_root, "mcp_plugin")
|
| 10 |
if mcp_plugin_dir not in sys.path:
|
|
|
|
| 5 |
import sys
|
| 6 |
import os
|
| 7 |
|
| 8 |
+
# Ensure local esm/source has highest priority
|
| 9 |
+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "source"))
|
| 10 |
+
|
| 11 |
project_root = os.path.dirname(os.path.abspath(__file__))
|
| 12 |
mcp_plugin_dir = os.path.join(project_root, "mcp_plugin")
|
| 13 |
if mcp_plugin_dir not in sys.path:
|