ahmed-7124 commited on
Commit
ba7185a
·
verified ·
1 Parent(s): 7fc1c6c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -13,8 +13,8 @@ classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnl
13
  image_model = timm.create_model('resnet50', pretrained=True)
14
  image_model.eval()
15
 
16
- # Load saved TensorFlow eye disease detection model
17
- eye_model = tf.keras.models.load_model('model.h5')
18
 
19
  # Patient database
20
  patients_db = []
@@ -87,9 +87,9 @@ def extract_pdf_report(pdf):
87
  def predict_eye_disease(input_image):
88
  input_image = tf.image.resize(input_image, [224, 224]) / 255.0
89
  input_image = tf.expand_dims(input_image, 0)
90
- predictions = eye_model.predict(input_image)
91
  labels = ['Cataract', 'Conjunctivitis', 'Glaucoma', 'Normal']
92
- confidence_scores = {labels[i]: round(predictions[0][i] * 100, 2) for i in range(len(labels))}
93
  if confidence_scores['Normal'] > 50:
94
  return f"Congrats! No disease detected. Confidence: {confidence_scores['Normal']}%"
95
  return "\n".join([f"{label}: {confidence}%" for label, confidence in confidence_scores.items()])
 
13
  image_model = timm.create_model('resnet50', pretrained=True)
14
  image_model.eval()
15
 
16
+ # Load saved TensorFlow eye disease detection model (TensorFlow Model without Keras)
17
+ eye_model = tf.saved_model.load('model')
18
 
19
  # Patient database
20
  patients_db = []
 
87
  def predict_eye_disease(input_image):
88
  input_image = tf.image.resize(input_image, [224, 224]) / 255.0
89
  input_image = tf.expand_dims(input_image, 0)
90
+ predictions = eye_model(input_image)
91
  labels = ['Cataract', 'Conjunctivitis', 'Glaucoma', 'Normal']
92
+ confidence_scores = {labels[i]: round(predictions[i] * 100, 2) for i in range(len(labels))}
93
  if confidence_scores['Normal'] > 50:
94
  return f"Congrats! No disease detected. Confidence: {confidence_scores['Normal']}%"
95
  return "\n".join([f"{label}: {confidence}%" for label, confidence in confidence_scores.items()])