Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,9 +7,15 @@ import supervision as sv
|
|
| 7 |
from inference import get_model
|
| 8 |
|
| 9 |
app = FastAPI()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# Load the pre-trained model once when the server starts
|
| 12 |
-
model = get_model(model_id="yolov8n")
|
| 13 |
|
| 14 |
def gen_frames():
|
| 15 |
# Open the default camera (index 0)
|
|
|
|
| 7 |
from inference import get_model
|
| 8 |
|
| 9 |
app = FastAPI()
|
| 10 |
+
import os
|
| 11 |
+
|
| 12 |
+
# Set writable directories for matplotlib and Hugging Face cache
|
| 13 |
+
os.environ["MPLCONFIGDIR"] = "/tmp/matplotlib"
|
| 14 |
+
os.environ["TRANSFORMERS_CACHE"] = "/tmp/huggingface"
|
| 15 |
+
os.environ["YOLO_CONFIG_DIR"] = "/tmp/Ultralytics"
|
| 16 |
|
| 17 |
# Load the pre-trained model once when the server starts
|
| 18 |
+
model = get_model(model_id="yolov8n-640")
|
| 19 |
|
| 20 |
def gen_frames():
|
| 21 |
# Open the default camera (index 0)
|