Spaces:
Sleeping
Sleeping
Update app.py
Browse files14 unmodified lines15161718192011 unmodified lines32333435363710 unmodified lines484950515253543 unmodified lines585960616263646514 unmodified lines# --- Load the Model ---print("[INFO] Attempting to load the trained model from: {}".format(MODEL_PATH))try:model = load_model(MODEL_PATH, custom_objects={"K": K})print("[SUCCESS] Model loaded successfully into memory.")except Exception as e:11 unmodified linesreturn {"Error": 1.0}print("[INFO] Received image for prediction.")image = input_image.convert("RGB").resize((IMAGE_SIZE, IMAGE_SIZE))image_array = np.asarray(image)image_array = image_array / 255.010 unmodified lines# ==============================================================================print("[INFO] Creating Gradio Blocks interface...")# Define the HTML for our custom-styled descriptiondescription_html = """<div style="text-align: center; font-size: 16px;">Lightweight CNN for Fire Detection with Integrated Hybrid Attention: A Depthwise-Driven Approach for Embedded Systems<br>3 unmodified lines"""# Build the interface component by componentwith gr.Blocks(theme=gr.themes.Soft()) as demo:# Title (using your new name)gr.Markdown("""<h1 style="text-align: center;">🔥 HyFiNet 🔥</h1>14 unmodified lines1516171819202111 unmodified lines3334353637383910 unmodified lines505152535455563 unmodified lines606162636465666714 unmodified lines# --- Load the Model ---print("[INFO] Attempting to load the trained model from: {}".format(MODEL_PATH))try:# We must tell load_model what 'K' means in our custom layers.model = load_model(MODEL_PATH, custom_objects={"K": K})print("[SUCCESS] Model loaded successfully into memory.")except Exception as e:11 unmodified linesreturn {"Error": 1.0}print("[INFO] Received image for prediction.")# Preprocess the image exactly as the model expectsimage = input_image.convert("RGB").resize((IMAGE_SIZE, IMAGE_SIZE))image_array = np.asarray(image)image_array = image_array / 255.010 unmodified lines# ==============================================================================print("[INFO] Creating Gradio Blocks interface...")# Define the HTML for our custom-styled description for centering and font sizedescription_html = """<div style="text-align: center; font-size: 16px;">Lightweight CNN for Fire Detection with Integrated Hybrid Attention: A Depthwise-Driven Approach for Embedded Systems<br>3 unmodified lines"""# Build the interface component by componentwith gr.Blocks() as demo: # Removed the 'theme' parameter for compatibility# Titlegr.Markdown("""<h1 style="text-align: center;">🔥 HyFiNet 🔥</h1>
app.py+5-3