Spaces:
Build error
Build error
File size: 1,612 Bytes
00817c7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | streamlit_app_code = """
import streamlit as st
from PIL import Image
import numpy as np
import keras
from huggingface_hub import from_pretrained_keras
# Load the pre-trained model for low light image enhancement
enhancement_model = from_pretrained_keras("ali444/VGG16_finetuned_79", compile=False)
enhancement_examples = ['examples/_0_1966.png', 'examples/_1_2118.png', 'examples/_1_5031.png']
# Load the pre-trained model for blood cell classification
classification_model = from_pretrained_keras("ali444/VGG16_finetuned_79", compile=False)
# Define class labels
class_names = ["EOSINOPHIL", "LYMPHOCYTE", "MONOCYTE", "NEUTROPHIL"]
# Create Streamlit app
st.title('Blood Cell Classification App')
# Upload an image through Streamlit
uploaded_file = st.file_uploader("Upload an image...", type="jpg")
if uploaded_file:
st.image(uploaded_file, caption="Uploaded Image.", use_column_width=True)
st.write("")
st.write("Classifying...")
# Preprocess the uploaded image
image = Image.open(uploaded_file)
image = image.resize((150, 150))
image_array = np.array(image) / 255.0
image_array = np.expand_dims(image_array, axis=0)
# Make predictions
classification_prediction = classification_model.predict(image_array)
predicted_class = class_names[np.argmax(classification_prediction)]
# Display the prediction result
st.success(f"Prediction: {predicted_class}")
# Add some additional information or instructions
st.write("")
st.write("Instructions:")
st.write("* Upload an image of a blood cell.")
st.write("* The app will predict the blood cell type.")
""" |