Spaces:
Running
Running
Commit ·
33cb1da
1
Parent(s): a65e39e
Fix: make visualization/collaborative imports optional
Browse files- These modules require extra deps (py3Dmol, fastapi) not needed for main UI
- Wrap imports in try/except to avoid startup failures
- Updated requirements.txt with all core dependencies
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- protein_conformal/backend/__init__.py +31 -15
- requirements.txt +12 -3
protein_conformal/backend/__init__.py
CHANGED
|
@@ -3,9 +3,9 @@ Backend module for Protein Conformal Prediction.
|
|
| 3 |
Contains the server-side implementation components.
|
| 4 |
"""
|
| 5 |
|
| 6 |
-
# Main interface components
|
| 7 |
from .gradio_interface import (
|
| 8 |
-
create_interface,
|
| 9 |
process_input,
|
| 10 |
validate_sequence,
|
| 11 |
highlight_sequence,
|
|
@@ -15,17 +15,33 @@ from .gradio_interface import (
|
|
| 15 |
export_current_results
|
| 16 |
)
|
| 17 |
|
| 18 |
-
# Visualization
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
Contains the server-side implementation components.
|
| 4 |
"""
|
| 5 |
|
| 6 |
+
# Main interface components (always available)
|
| 7 |
from .gradio_interface import (
|
| 8 |
+
create_interface,
|
| 9 |
process_input,
|
| 10 |
validate_sequence,
|
| 11 |
highlight_sequence,
|
|
|
|
| 15 |
export_current_results
|
| 16 |
)
|
| 17 |
|
| 18 |
+
# Optional: Visualization module (requires py3Dmol, networkx, seaborn)
|
| 19 |
+
# These are not used by the main Gradio interface
|
| 20 |
+
try:
|
| 21 |
+
from .visualization import (
|
| 22 |
+
create_structure_with_heatmap,
|
| 23 |
+
create_similarity_network,
|
| 24 |
+
create_statistical_summary,
|
| 25 |
+
format_html_report
|
| 26 |
+
)
|
| 27 |
+
except ImportError:
|
| 28 |
+
# Visualization not available - missing optional dependencies
|
| 29 |
+
create_structure_with_heatmap = None
|
| 30 |
+
create_similarity_network = None
|
| 31 |
+
create_statistical_summary = None
|
| 32 |
+
format_html_report = None
|
| 33 |
|
| 34 |
+
# Optional: Collaborative API module (requires fastapi, uvicorn)
|
| 35 |
+
try:
|
| 36 |
+
from .collaborative import (
|
| 37 |
+
save_session,
|
| 38 |
+
load_session,
|
| 39 |
+
export_report,
|
| 40 |
+
create_api_app
|
| 41 |
+
)
|
| 42 |
+
except ImportError:
|
| 43 |
+
# Collaborative features not available - missing optional dependencies
|
| 44 |
+
save_session = None
|
| 45 |
+
load_session = None
|
| 46 |
+
export_report = None
|
| 47 |
+
create_api_app = None
|
requirements.txt
CHANGED
|
@@ -8,14 +8,23 @@ biopython>=1.81
|
|
| 8 |
# ML/Embeddings
|
| 9 |
torch>=2.0.0
|
| 10 |
faiss-cpu>=1.7.4
|
|
|
|
| 11 |
|
| 12 |
# Gradio UI
|
| 13 |
gradio>=4.0.0
|
| 14 |
|
| 15 |
-
# Visualization
|
| 16 |
matplotlib>=3.5.0
|
| 17 |
plotly>=5.9.0
|
| 18 |
|
| 19 |
-
# HuggingFace integration
|
| 20 |
huggingface_hub>=0.20.0
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
# ML/Embeddings
|
| 9 |
torch>=2.0.0
|
| 10 |
faiss-cpu>=1.7.4
|
| 11 |
+
transformers>=4.30.0
|
| 12 |
|
| 13 |
# Gradio UI
|
| 14 |
gradio>=4.0.0
|
| 15 |
|
| 16 |
+
# Visualization (required by gradio_interface)
|
| 17 |
matplotlib>=3.5.0
|
| 18 |
plotly>=5.9.0
|
| 19 |
|
| 20 |
+
# HuggingFace integration (for downloading assets)
|
| 21 |
huggingface_hub>=0.20.0
|
| 22 |
+
|
| 23 |
+
# Optional visualization dependencies (for visualization.py if used)
|
| 24 |
+
# py3Dmol>=1.8.0
|
| 25 |
+
# networkx>=2.8.0
|
| 26 |
+
# seaborn>=0.12.0
|
| 27 |
+
|
| 28 |
+
# Optional API dependencies (for collaborative.py if used)
|
| 29 |
+
# fastapi>=0.90.0
|
| 30 |
+
# uvicorn>=0.18.0
|