Update app.py - add comment for categories and remove is_pneumonia
Browse files
app.py
CHANGED
|
@@ -6,17 +6,13 @@ from fastai.vision.all import *
|
|
| 6 |
import gradio as gr
|
| 7 |
|
| 8 |
|
| 9 |
-
# Function to determine if an image contains pneumonia
|
| 10 |
-
# Checks if the filename contains 'virus' or 'bacteria'
|
| 11 |
-
def is_pneumonia(x):
|
| 12 |
-
return (x.find('virus')!=-1 or x.find('bacteria')!=-1)
|
| 13 |
-
|
| 14 |
-
|
| 15 |
# Load the trained fastai model for predictions
|
| 16 |
learn = load_learner('pneumonia_model.pkl')
|
| 17 |
|
| 18 |
|
| 19 |
# Define the possible categories for prediction
|
|
|
|
|
|
|
| 20 |
categories = learn.dls.vocab
|
| 21 |
|
| 22 |
|
|
|
|
| 6 |
import gradio as gr
|
| 7 |
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
# Load the trained fastai model for predictions
|
| 10 |
learn = load_learner('pneumonia_model.pkl')
|
| 11 |
|
| 12 |
|
| 13 |
# Define the possible categories for prediction
|
| 14 |
+
# Use the categories directly from the DataLoaders vocab
|
| 15 |
+
# categories: 'PNEUMONIA' or 'NORMAL'
|
| 16 |
categories = learn.dls.vocab
|
| 17 |
|
| 18 |
|