Update app.py
Browse files
app.py
CHANGED
@@ -40,16 +40,12 @@ log_path = "prediction_logs.csv"
|
|
40 |
def log_prediction(filename, prediction, confidence):
|
41 |
timestamp = datetime.datetime.now().isoformat()
|
42 |
row = [timestamp, filename, prediction, f"{confidence:.4f}"]
|
43 |
-
|
44 |
-
if not os.path.exists(log_path):
|
45 |
-
with open(log_path, mode='w', newline='') as file:
|
46 |
-
writer = csv.writer(file)
|
47 |
-
writer.writerow(["timestamp", "image_name", "prediction", "confidence"])
|
48 |
-
|
49 |
with open(log_path, mode='a', newline='') as file:
|
50 |
writer = csv.writer(file)
|
51 |
writer.writerow(row)
|
52 |
|
|
|
53 |
# Prediction function
|
54 |
def predict_retinopathy(image):
|
55 |
img = image.convert("RGB").resize((224, 224))
|
|
|
40 |
def log_prediction(filename, prediction, confidence):
|
41 |
timestamp = datetime.datetime.now().isoformat()
|
42 |
row = [timestamp, filename, prediction, f"{confidence:.4f}"]
|
43 |
+
|
|
|
|
|
|
|
|
|
|
|
44 |
with open(log_path, mode='a', newline='') as file:
|
45 |
writer = csv.writer(file)
|
46 |
writer.writerow(row)
|
47 |
|
48 |
+
|
49 |
# Prediction function
|
50 |
def predict_retinopathy(image):
|
51 |
img = image.convert("RGB").resize((224, 224))
|