Spaces:
Sleeping
Sleeping
Update app/services/legal_bert.py
Browse files
app/services/legal_bert.py
CHANGED
|
@@ -24,7 +24,7 @@ class LegalBertService:
|
|
| 24 |
os.makedirs(extractPath)
|
| 25 |
logger.info(f"Created model directory: {extractPath}")
|
| 26 |
|
| 27 |
-
|
| 28 |
if os.path.exists(os.path.join(extractPath, "config.json")):
|
| 29 |
logger.info("Model already extracted")
|
| 30 |
return True
|
|
@@ -42,14 +42,14 @@ class LegalBertService:
|
|
| 42 |
|
| 43 |
def _load_model(self):
|
| 44 |
try:
|
| 45 |
-
|
| 46 |
zipPath = os.path.join("./models", "legalbert_epoch4.zip")
|
| 47 |
|
| 48 |
if os.path.exists(zipPath):
|
| 49 |
if self._extract_model_from_zip(zipPath, settings.legal_bert_model_path):
|
| 50 |
logger.info("Model zip file found and extracted")
|
| 51 |
|
| 52 |
-
|
| 53 |
if os.path.exists(settings.legal_bert_model_path) and os.path.exists(os.path.join(settings.legal_bert_model_path, "config.json")):
|
| 54 |
try:
|
| 55 |
import torch
|
|
|
|
| 24 |
os.makedirs(extractPath)
|
| 25 |
logger.info(f"Created model directory: {extractPath}")
|
| 26 |
|
| 27 |
+
|
| 28 |
if os.path.exists(os.path.join(extractPath, "config.json")):
|
| 29 |
logger.info("Model already extracted")
|
| 30 |
return True
|
|
|
|
| 42 |
|
| 43 |
def _load_model(self):
|
| 44 |
try:
|
| 45 |
+
|
| 46 |
zipPath = os.path.join("./models", "legalbert_epoch4.zip")
|
| 47 |
|
| 48 |
if os.path.exists(zipPath):
|
| 49 |
if self._extract_model_from_zip(zipPath, settings.legal_bert_model_path):
|
| 50 |
logger.info("Model zip file found and extracted")
|
| 51 |
|
| 52 |
+
|
| 53 |
if os.path.exists(settings.legal_bert_model_path) and os.path.exists(os.path.join(settings.legal_bert_model_path, "config.json")):
|
| 54 |
try:
|
| 55 |
import torch
|