erayman09 commited on
Commit
5637e13
·
verified ·
1 Parent(s): 74dd904

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -28,6 +28,10 @@ parameter_mapping = {
28
  "wbc": "wbc",
29
  "plt": "platelet",
30
  "platelets": "platelet",
 
 
 
 
31
  # Add more mappings as needed
32
  }
33
 
@@ -43,7 +47,7 @@ def extract_text_from_image(image_path):
43
 
44
  # Extract value using regex
45
  def extract_value(text, param):
46
- match = re.search(rf"{param}\s*:\s*([\d.]+)", text, re.IGNORECASE)
47
  if match:
48
  return float(match.group(1))
49
  return None
@@ -67,7 +71,6 @@ def analyze_blood_report(text):
67
  else:
68
  analysis += f"{standard_param.capitalize()} could not be analyzed.\n"
69
 
70
- # Flag abnormalities
71
  if abnormalities:
72
  analysis += "\nAbnormalities Detected:\n" + "\n".join(abnormalities) + "\n"
73
  else:
@@ -131,7 +134,7 @@ interface = gr.Interface(
131
  css="""
132
  body {
133
  font-family: 'Arial', sans-serif;
134
- background-color: #f9f9f9;
135
  }
136
  .gradio-container {
137
  color: #333;
 
28
  "wbc": "wbc",
29
  "plt": "platelet",
30
  "platelets": "platelet",
31
+ "hematocrit": "hematocrit",
32
+ "mcv": "mcv",
33
+ "mch": "mch",
34
+ "mchc": "mchc",
35
  # Add more mappings as needed
36
  }
37
 
 
47
 
48
  # Extract value using regex
49
  def extract_value(text, param):
50
+ match = re.search(rf"{param}[:\s]*([\d.]+)", text, re.IGNORECASE)
51
  if match:
52
  return float(match.group(1))
53
  return None
 
71
  else:
72
  analysis += f"{standard_param.capitalize()} could not be analyzed.\n"
73
 
 
74
  if abnormalities:
75
  analysis += "\nAbnormalities Detected:\n" + "\n".join(abnormalities) + "\n"
76
  else:
 
134
  css="""
135
  body {
136
  font-family: 'Arial', sans-serif;
137
+ background-color: #000000;
138
  }
139
  .gradio-container {
140
  color: #333;