Spaces:
Running
Running
Sadjad Alikhani
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -54,7 +54,7 @@ def load_custom_model():
|
|
54 |
def process_p_file(uploaded_file, percentage_idx, complexity_idx):
|
55 |
capture = PrintCapture()
|
56 |
sys.stdout = capture # Redirect print statements to capture
|
57 |
-
|
58 |
try:
|
59 |
model_repo_url = "https://huggingface.co/sadjadalikhani/LWM"
|
60 |
model_repo_dir = "./LWM"
|
@@ -69,9 +69,11 @@ def process_p_file(uploaded_file, percentage_idx, complexity_idx):
|
|
69 |
else:
|
70 |
return f"Directory {model_repo_dir} does not exist."
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
75 |
device = 'cpu'
|
76 |
print(f"Loading the LWM model on {device}...")
|
77 |
model = LWM.from_pretrained(device=device)
|
|
|
54 |
def process_p_file(uploaded_file, percentage_idx, complexity_idx):
|
55 |
capture = PrintCapture()
|
56 |
sys.stdout = capture # Redirect print statements to capture
|
57 |
+
|
58 |
try:
|
59 |
model_repo_url = "https://huggingface.co/sadjadalikhani/LWM"
|
60 |
model_repo_dir = "./LWM"
|
|
|
69 |
else:
|
70 |
return f"Directory {model_repo_dir} does not exist."
|
71 |
|
72 |
+
# Add LWM repo path to Python module search path
|
73 |
+
if model_repo_dir not in sys.path:
|
74 |
+
sys.path.append(model_repo_dir)
|
75 |
+
|
76 |
+
from lwm_model import LWM # Now this should work
|
77 |
device = 'cpu'
|
78 |
print(f"Loading the LWM model on {device}...")
|
79 |
model = LWM.from_pretrained(device=device)
|