Spaces:
Runtime error
Runtime error
Tantawi65 commited on
Commit ·
2822f6c
1
Parent(s): 1736c15
Fix: Enable actual model prediction instead of fallback function
Browse files- main.py +6 -1
- requirements.txt +2 -1
main.py
CHANGED
|
@@ -6,9 +6,14 @@ from fastapi.responses import JSONResponse
|
|
| 6 |
from fastapi.middleware.cors import CORSMiddleware
|
| 7 |
|
| 8 |
# Import the prediction function
|
|
|
|
|
|
|
|
|
|
| 9 |
try:
|
| 10 |
from app.predict import predict_image
|
| 11 |
-
|
|
|
|
|
|
|
| 12 |
# Fallback prediction function for testing
|
| 13 |
def predict_image(image_path):
|
| 14 |
return "test_condition", 0.85, [{"label": "test_condition", "confidence": 0.85}]
|
|
|
|
| 6 |
from fastapi.middleware.cors import CORSMiddleware
|
| 7 |
|
| 8 |
# Import the prediction function
|
| 9 |
+
import sys
|
| 10 |
+
sys.path.append('/code')
|
| 11 |
+
|
| 12 |
try:
|
| 13 |
from app.predict import predict_image
|
| 14 |
+
print("Successfully imported predict_image function")
|
| 15 |
+
except ImportError as e:
|
| 16 |
+
print(f"Failed to import predict_image: {e}")
|
| 17 |
# Fallback prediction function for testing
|
| 18 |
def predict_image(image_path):
|
| 19 |
return "test_condition", 0.85, [{"label": "test_condition", "confidence": 0.85}]
|
requirements.txt
CHANGED
|
@@ -3,4 +3,5 @@ uvicorn[standard]
|
|
| 3 |
python-multipart
|
| 4 |
numpy
|
| 5 |
Pillow
|
| 6 |
-
tensorflow==2.10.0
|
|
|
|
|
|
| 3 |
python-multipart
|
| 4 |
numpy
|
| 5 |
Pillow
|
| 6 |
+
tensorflow==2.10.0
|
| 7 |
+
huggingface_hub
|