Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ transform = transforms.Compose([
|
|
19 |
|
20 |
# Streamlit UI
|
21 |
st.title("Saliva Disease Detection App")
|
22 |
-
st.subheader("Predict
|
23 |
|
24 |
# Initialize session state for managing the uploaded file
|
25 |
if "uploaded_file" not in st.session_state:
|
@@ -46,13 +46,14 @@ if st.session_state["uploaded_file"] is not None:
|
|
46 |
_, predicted_class = torch.max(outputs, 1)
|
47 |
|
48 |
# Map predicted class to labels
|
49 |
-
class_names = ['Not_Streptococcosis', 'Streptococcosis']
|
|
|
50 |
predicted_label = class_names[predicted_class.item()]
|
51 |
predicted_probability = probabilities[0][predicted_class.item()].item() * 100 # Convert to percentage
|
52 |
|
53 |
# Display the result
|
54 |
st.write("### Prediction Result:")
|
55 |
-
if predicted_label == "
|
56 |
st.error(f"The sample is predicted as **{predicted_label}** with **{predicted_probability:.2f}%** probability.")
|
57 |
else:
|
58 |
st.success(f"The sample is predicted as **{predicted_label}** with **{predicted_probability:.2f}%** probability.")
|
|
|
19 |
|
20 |
# Streamlit UI
|
21 |
st.title("Saliva Disease Detection App")
|
22 |
+
st.subheader("Predict Streptococcal infection present vs Streptococcal infection not present from uploaded saliva images")
|
23 |
|
24 |
# Initialize session state for managing the uploaded file
|
25 |
if "uploaded_file" not in st.session_state:
|
|
|
46 |
_, predicted_class = torch.max(outputs, 1)
|
47 |
|
48 |
# Map predicted class to labels
|
49 |
+
#class_names = ['Not_Streptococcosis', 'Streptococcosis']
|
50 |
+
class_names = ['Streptococcal_Infection_Not_Present', 'Streptococcal_Infection_Present']
|
51 |
predicted_label = class_names[predicted_class.item()]
|
52 |
predicted_probability = probabilities[0][predicted_class.item()].item() * 100 # Convert to percentage
|
53 |
|
54 |
# Display the result
|
55 |
st.write("### Prediction Result:")
|
56 |
+
if predicted_label == "Streptococcal_Infection_Present":
|
57 |
st.error(f"The sample is predicted as **{predicted_label}** with **{predicted_probability:.2f}%** probability.")
|
58 |
else:
|
59 |
st.success(f"The sample is predicted as **{predicted_label}** with **{predicted_probability:.2f}%** probability.")
|