Spaces:
Build error
Build error
| 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.") | |
| """ |