|
import gradio as gr |
|
from solar_fault_model import predict_damage |
|
|
|
|
|
def classify_damage(image): |
|
|
|
image_path = "temp_image.jpg" |
|
image.save(image_path) |
|
|
|
|
|
return predict_damage(image_path) |
|
|
|
|
|
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() |
|
|