Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,6 @@ import os
|
|
2 |
|
3 |
os.environ['HF_HOME'] = '/tmp/.cache/huggingface' # Use /tmp in Spaces
|
4 |
os.makedirs(os.environ['HF_HOME'], exist_ok=True) # Ensure directory exists
|
5 |
-
os.environ['TRANSFORMERS_CACHE'] = os.environ['HF_HOME']
|
6 |
|
7 |
from fastapi import FastAPI
|
8 |
from qwen_classifier.predict import predict_single # Your existing function
|
@@ -28,7 +27,6 @@ async def load_model():
|
|
28 |
# Load model (will cache in /home/user/.cache/huggingface)
|
29 |
app.state.model = QwenClassifier.from_pretrained(
|
30 |
'KeivanR/Qwen2.5-1.5B-Instruct-MLB-clf_lora-1743189446',
|
31 |
-
cache_dir=os.environ['HF_HOME'] # Explicit cache location
|
32 |
)
|
33 |
print("Model loaded successfully!")
|
34 |
|
|
|
2 |
|
3 |
os.environ['HF_HOME'] = '/tmp/.cache/huggingface' # Use /tmp in Spaces
|
4 |
os.makedirs(os.environ['HF_HOME'], exist_ok=True) # Ensure directory exists
|
|
|
5 |
|
6 |
from fastapi import FastAPI
|
7 |
from qwen_classifier.predict import predict_single # Your existing function
|
|
|
27 |
# Load model (will cache in /home/user/.cache/huggingface)
|
28 |
app.state.model = QwenClassifier.from_pretrained(
|
29 |
'KeivanR/Qwen2.5-1.5B-Instruct-MLB-clf_lora-1743189446',
|
|
|
30 |
)
|
31 |
print("Model loaded successfully!")
|
32 |
|