Spaces:
Sleeping
Sleeping
Commit
·
7659667
1
Parent(s):
f82e0a6
trying to fix the image analysis issue
Browse files
main.py
CHANGED
|
@@ -9,6 +9,7 @@ from config import config
|
|
| 9 |
from database import db
|
| 10 |
from ai_model import ai_models
|
| 11 |
import uvicorn
|
|
|
|
| 12 |
|
| 13 |
app = FastAPI(
|
| 14 |
title="MobileDoc API",
|
|
@@ -123,7 +124,7 @@ async def symptom_check(request: SymptomsRequest):
|
|
| 123 |
"id": str(uuid.uuid4()),
|
| 124 |
"user_id": request.user_id,
|
| 125 |
"symptoms": request.symptoms,
|
| 126 |
-
"result": analysis_result
|
| 127 |
})
|
| 128 |
|
| 129 |
return AnalysisResponse(
|
|
@@ -162,7 +163,7 @@ async def analyze_image(
|
|
| 162 |
"id": str(uuid.uuid4()),
|
| 163 |
"user_id": user_id,
|
| 164 |
"filename": filename,
|
| 165 |
-
"result": analysis_result,
|
| 166 |
"confidence": analysis_result.get("confidence", 0.0)
|
| 167 |
})
|
| 168 |
|
|
@@ -172,6 +173,7 @@ async def analyze_image(
|
|
| 172 |
message="Image analyzed successfully"
|
| 173 |
)
|
| 174 |
except Exception as e:
|
|
|
|
| 175 |
raise HTTPException(status_code=500, detail=str(e))
|
| 176 |
|
| 177 |
|
|
|
|
| 9 |
from database import db
|
| 10 |
from ai_model import ai_models
|
| 11 |
import uvicorn
|
| 12 |
+
import json
|
| 13 |
|
| 14 |
app = FastAPI(
|
| 15 |
title="MobileDoc API",
|
|
|
|
| 124 |
"id": str(uuid.uuid4()),
|
| 125 |
"user_id": request.user_id,
|
| 126 |
"symptoms": request.symptoms,
|
| 127 |
+
"result": json.dumps(analysis_result)
|
| 128 |
})
|
| 129 |
|
| 130 |
return AnalysisResponse(
|
|
|
|
| 163 |
"id": str(uuid.uuid4()),
|
| 164 |
"user_id": user_id,
|
| 165 |
"filename": filename,
|
| 166 |
+
"result": json.dumps(analysis_result),
|
| 167 |
"confidence": analysis_result.get("confidence", 0.0)
|
| 168 |
})
|
| 169 |
|
|
|
|
| 173 |
message="Image analyzed successfully"
|
| 174 |
)
|
| 175 |
except Exception as e:
|
| 176 |
+
print("🔥 SERVER ERROR:", repr(e))
|
| 177 |
raise HTTPException(status_code=500, detail=str(e))
|
| 178 |
|
| 179 |
|