Update app.py
Browse files
app.py
CHANGED
|
@@ -103,6 +103,20 @@ def convert_sbml_to_antimony(sbml_file_path, antimony_file_path):
|
|
| 103 |
print(f"Error converting SBML to Antimony: {e}")
|
| 104 |
|
| 105 |
def split_biomodels(antimony_file_path):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
text_splitter = SpacyTextSplitter(chunk_size=1000)
|
| 107 |
|
| 108 |
final_items = []
|
|
|
|
| 103 |
print(f"Error converting SBML to Antimony: {e}")
|
| 104 |
|
| 105 |
def split_biomodels(antimony_file_path):
|
| 106 |
+
import subprocess
|
| 107 |
+
|
| 108 |
+
# Try to load the spaCy model; if it fails, download it
|
| 109 |
+
def ensure_spacy_model():
|
| 110 |
+
try:
|
| 111 |
+
nlp = spacy.load("en_core_web_sm")
|
| 112 |
+
except OSError:
|
| 113 |
+
# If the model is not available, download it
|
| 114 |
+
subprocess.run(["python", "-m", "spacy", "download", "en_core_web_sm"])
|
| 115 |
+
nlp = spacy.load("en_core_web_sm")
|
| 116 |
+
return nlp
|
| 117 |
+
|
| 118 |
+
# Ensure the spaCy model is installed
|
| 119 |
+
nlp = ensure_spacy_model()
|
| 120 |
text_splitter = SpacyTextSplitter(chunk_size=1000)
|
| 121 |
|
| 122 |
final_items = []
|