issoufzousko07 commited on
Commit
74b2d02
·
verified ·
1 Parent(s): 908ed88

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. database.py +13 -0
  2. main.py +10 -8
database.py CHANGED
@@ -57,6 +57,19 @@ def init_db():
57
  )
58
  ''')
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  # Create Patients Table
61
  c.execute('''
62
  CREATE TABLE IF NOT EXISTS patients (
 
57
  )
58
  ''')
59
 
60
+ # --- MIGRATIONS ---
61
+ # Ensure security columns exist (backward compatibility)
62
+ try:
63
+ c.execute("ALTER TABLE users ADD COLUMN security_question TEXT DEFAULT 'Question?'")
64
+ except sqlite3.OperationalError:
65
+ pass # Column exists
66
+
67
+ try:
68
+ c.execute("ALTER TABLE users ADD COLUMN security_answer TEXT DEFAULT 'answer'")
69
+ except sqlite3.OperationalError:
70
+ pass # Column exists
71
+ # ------------------
72
+
73
  # Create Patients Table
74
  c.execute('''
75
  CREATE TABLE IF NOT EXISTS patients (
main.py CHANGED
@@ -1110,14 +1110,16 @@ class MedSigClipWrapper:
1110
  image_array = np.array(image)
1111
 
1112
  # Get image embedding for similar case detection
1113
- try:
1114
- with torch.no_grad():
1115
- img_inputs = self.processor(images=image, return_tensors="pt")
1116
- image_embedding = self.model.get_image_features(**img_inputs)
1117
- image_embedding = image_embedding.cpu().numpy().flatten()
1118
- except Exception as e_emb:
1119
- logger.warning(f"Could not extract embedding: {e_emb}")
1120
- image_embedding = None
 
 
1121
 
1122
  # Enhance result with all algorithms
1123
  enhanced_result = enhance_analysis_result(
 
1110
  image_array = np.array(image)
1111
 
1112
  # Get image embedding for similar case detection
1113
+ # OPT PERFORMANCE: Disabled to reduce inference time (<60s)
1114
+ image_embedding = None
1115
+ # try:
1116
+ # with torch.no_grad():
1117
+ # img_inputs = self.processor(images=image, return_tensors="pt")
1118
+ # image_embedding = self.model.get_image_features(**img_inputs)
1119
+ # image_embedding = image_embedding.cpu().numpy().flatten()
1120
+ # except Exception as e_emb:
1121
+ # logger.warning(f"Could not extract embedding: {e_emb}")
1122
+ # image_embedding = None
1123
 
1124
  # Enhance result with all algorithms
1125
  enhanced_result = enhance_analysis_result(