Spaces:
Sleeping
Sleeping
Update src/ai_processor.py
Browse files- src/ai_processor.py +3 -3
src/ai_processor.py
CHANGED
|
@@ -42,7 +42,7 @@ class AIProcessor:
|
|
| 42 |
model="google/medgemma-4b-it",
|
| 43 |
torch_dtype=torch.bfloat16,
|
| 44 |
offload_folder="offload",
|
| 45 |
-
device_map="
|
| 46 |
token=self.config.HF_TOKEN
|
| 47 |
)
|
| 48 |
logging.info("✅ MedGemma pipeline loaded successfully")
|
|
@@ -246,7 +246,7 @@ class AIProcessor:
|
|
| 246 |
logging.error(f"Guidelines query error: {e}")
|
| 247 |
return f"Error querying guidelines: {str(e)}"
|
| 248 |
|
| 249 |
-
|
| 250 |
def generate_final_report(self, patient_info, visual_results, guideline_context, image_pil, max_new_tokens=None):
|
| 251 |
"""Generate comprehensive medical report using MedGemma"""
|
| 252 |
try:
|
|
@@ -438,7 +438,7 @@ Based on the visual analysis, this appears to be a {visual_results.get('wound_ty
|
|
| 438 |
logging.error(f"Image saving error: {e}")
|
| 439 |
return None
|
| 440 |
|
| 441 |
-
|
| 442 |
def full_analysis_pipeline(self, image, questionnaire_data):
|
| 443 |
"""Complete analysis pipeline with real-time models"""
|
| 444 |
try:
|
|
|
|
| 42 |
model="google/medgemma-4b-it",
|
| 43 |
torch_dtype=torch.bfloat16,
|
| 44 |
offload_folder="offload",
|
| 45 |
+
device_map="cuda",
|
| 46 |
token=self.config.HF_TOKEN
|
| 47 |
)
|
| 48 |
logging.info("✅ MedGemma pipeline loaded successfully")
|
|
|
|
| 246 |
logging.error(f"Guidelines query error: {e}")
|
| 247 |
return f"Error querying guidelines: {str(e)}"
|
| 248 |
|
| 249 |
+
@spaces.GPU(enable_queue=True, duration=120)
|
| 250 |
def generate_final_report(self, patient_info, visual_results, guideline_context, image_pil, max_new_tokens=None):
|
| 251 |
"""Generate comprehensive medical report using MedGemma"""
|
| 252 |
try:
|
|
|
|
| 438 |
logging.error(f"Image saving error: {e}")
|
| 439 |
return None
|
| 440 |
|
| 441 |
+
|
| 442 |
def full_analysis_pipeline(self, image, questionnaire_data):
|
| 443 |
"""Complete analysis pipeline with real-time models"""
|
| 444 |
try:
|