Spaces:
Sleeping
Sleeping
fix: numba caching
Browse files- __pycache__/main.cpython-312.pyc +0 -0
- main.py +16 -14
__pycache__/main.cpython-312.pyc
CHANGED
|
Binary files a/__pycache__/main.cpython-312.pyc and b/__pycache__/main.cpython-312.pyc differ
|
|
|
main.py
CHANGED
|
@@ -1,13 +1,14 @@
|
|
| 1 |
-
import sys
|
| 2 |
import os
|
| 3 |
-
os.environ["NUMBA_DISABLE_JIT"] = "1"
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# Add the parent directory to Python path for imports
|
| 6 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 7 |
parent_dir = os.path.dirname(current_dir)
|
| 8 |
if parent_dir not in sys.path:
|
| 9 |
sys.path.insert(0, parent_dir)
|
| 10 |
-
|
| 11 |
from fastapi import FastAPI, File, UploadFile, HTTPException
|
| 12 |
import uvicorn
|
| 13 |
import numpy as np
|
|
@@ -20,16 +21,16 @@ from PIL import Image
|
|
| 20 |
from fastapi.middleware.cors import CORSMiddleware
|
| 21 |
|
| 22 |
# Try different import methods for download_model
|
| 23 |
-
try:
|
| 24 |
-
|
| 25 |
-
except ImportError:
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
|
| 34 |
# Initialize FastAPI app
|
| 35 |
app = FastAPI(
|
|
@@ -48,10 +49,11 @@ app.add_middleware(
|
|
| 48 |
)
|
| 49 |
|
| 50 |
# Download model if not exists
|
| 51 |
-
download_model()
|
| 52 |
|
| 53 |
# Loading the trained model
|
| 54 |
MODEL = tf.keras.models.load_model("./model/model_inceptionV3.h5")
|
|
|
|
| 55 |
|
| 56 |
# Class names (High activity or Low activity)
|
| 57 |
CLASS_NAMES = ["High activity", "Low activity"]
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
+
# os.environ["NUMBA_DISABLE_JIT"] = "1"
|
| 3 |
+
os.environ["NUMBA_CACHE_DIR"] = "/tmp/numba_cache"
|
| 4 |
+
|
| 5 |
+
import sys
|
| 6 |
|
| 7 |
# Add the parent directory to Python path for imports
|
| 8 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 9 |
parent_dir = os.path.dirname(current_dir)
|
| 10 |
if parent_dir not in sys.path:
|
| 11 |
sys.path.insert(0, parent_dir)
|
|
|
|
| 12 |
from fastapi import FastAPI, File, UploadFile, HTTPException
|
| 13 |
import uvicorn
|
| 14 |
import numpy as np
|
|
|
|
| 21 |
from fastapi.middleware.cors import CORSMiddleware
|
| 22 |
|
| 23 |
# Try different import methods for download_model
|
| 24 |
+
# try:
|
| 25 |
+
# from API.download_model import download_model
|
| 26 |
+
# except ImportError:
|
| 27 |
+
# try:
|
| 28 |
+
# from download_model import download_model
|
| 29 |
+
# except ImportError:
|
| 30 |
+
# # If all else fails, define a simple fallback
|
| 31 |
+
# def download_model():
|
| 32 |
+
# print("Model download function not available")
|
| 33 |
+
# pass
|
| 34 |
|
| 35 |
# Initialize FastAPI app
|
| 36 |
app = FastAPI(
|
|
|
|
| 49 |
)
|
| 50 |
|
| 51 |
# Download model if not exists
|
| 52 |
+
# download_model()
|
| 53 |
|
| 54 |
# Loading the trained model
|
| 55 |
MODEL = tf.keras.models.load_model("./model/model_inceptionV3.h5")
|
| 56 |
+
print("Loaded model:", type(MODEL))
|
| 57 |
|
| 58 |
# Class names (High activity or Low activity)
|
| 59 |
CLASS_NAMES = ["High activity", "Low activity"]
|