Siraja704 commited on
Commit ·
c67397a
1
Parent(s): 4835d52
Upgrade to Keras 3.0 with JAX backend and direct HF model loading
Browse files- Set KERAS_BACKEND to 'jax' for improved performance
- Use keras.saving.load_model('hf://Siraja704/DermaAI') for direct model loading
- Remove dependency on huggingface_hub package
- Add jax[cpu] to requirements for JAX backend support
- Update README with modern technical stack information
- Simplify model loading process with new Keras 3.0 features
Files changed (3)
- README.md+16-1
- app.py+9-12
- requirements.txt+2-1
14 unmodified lines151617181920212223242526272829303132332034353637383914 unmodified lines
AI-powered skin condition analysis using deep learning with EfficientNetV2 architecture.
## Features
- **Modern Keras 3.0 with JAX Backend**: Uses the latest Keras with JAX for improved performance- **Direct HuggingFace Model Loading**: Loads models directly from HuggingFace Hub- **5 Skin Conditions**: Classifies Atopic Dermatitis, Eczema, Psoriasis, Seborrheic Keratoses, and Tinea Ringworm Candidiasis- **Medical Disclaimers**: Includes proper medical disclaimers and advice
## Technical Stack
- **Backend**: JAX (via Keras 3.0)- **Frontend**: Gradio 5.0+- **Model Architecture**: EfficientNetV2- **Model Source**: Direct loading from `hf://Siraja704/DermaAI`
## Setup
This Space requires authentication to access the private model. To run this Space:This application uses Keras 3.0 with JAX backend for optimal performance. The model is loaded directly from HuggingFace Hub using the new `keras.saving.load_model("hf://...")` syntax.
If the model repository is private, you may need to:1. Go to the Space settings2. Add a new secret with key `HF_TOKEN` and your Hugging Face access token as the value3. Make sure your token has access to the `Siraja704/DermaAI` model repository1234526785910711121319 unmodified lines3334353336373836373839404142433940414243# Available backend options are: "jax", "torch", "tensorflow".import osos.environ["KERAS_BACKEND"] = "jax"
import gradio as grimport tensorflow as tfimport kerasimport numpy as npfrom PIL import Imagefrom huggingface_hub import hf_hub_downloadimport tensorflow as tf # Keep for preprocessing functionfrom tensorflow.keras.applications.efficientnet_v2 import preprocess_inputimport os
# Class names for the 5 skin conditionsCLASS_NAMES = [19 unmodified lines self.load_model() def load_model(self): """Load the DermaAI model from Hugging Face Hub""" """Load the DermaAI model from Hugging Face Hub using Keras 3.0""" try: print("🔄 Loading DermaAI model from Hugging Face...") # Get HF token from environment variable for authentication hf_token = os.getenv("HF_TOKEN") model_path = hf_hub_download( repo_id="Siraja704/DermaAI", filename="DermaAI.keras", token=hf_token ) self.model = tf.keras.models.load_model(model_path) # Load model directly from Hugging Face using Keras 3.0 self.model = keras.saving.load_model("hf://Siraja704/DermaAI") print("✅ Model loaded successfully!") except Exception as e: error_msg = str(e)1234356gradio>=5.0.0keras>=3.0.0jax[cpu]>=0.4.0tensorflow>=2.13.0huggingface_hub>=0.20.0pillow>=9.0.0numpy>=1.21.0README.md+16-1
app.py+9-12
requirements.txt+2-1