Prasanna1622's picture
Create app.py
af0ac52 verified
raw
history blame contribute delete
749 Bytes
import gradio as gr
from solar_fault_model import predict_damage
# Function that integrates with Gradio for inference
def classify_damage(image):
# Save uploaded image to a temporary file
image_path = "temp_image.jpg"
image.save(image_path)
# Predict the damage type using the model
return predict_damage(image_path)
# Define Gradio interface
demo = gr.Interface(
fn=classify_damage,
inputs=gr.Image(type="pil", label="Upload Solar Panel Image"),
outputs=gr.Textbox(label="Damage Type"),
title="Solar Panel Damage Detection",
description="Upload an image of a damaged solar panel to classify the damage type (e.g., cracked, dusted, shaded, overheated)."
)
if __name__ == "__main__":
demo.launch()