Upload 3 files
Browse files- .gitattributes +1 -0
- app1.py +29 -0
- requirements.txt +6 -0
- static_cnn_colab_final.keras +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
static_cnn_colab_final.keras filter=lfs diff=lfs merge=lfs -text
|
app1.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import numpy as np
|
3 |
+
from tensorflow.keras.models import load_model
|
4 |
+
from PIL import Image
|
5 |
+
|
6 |
+
model = load_model("static_cnn_colab_final.keras")
|
7 |
+
|
8 |
+
class_names = ['cloudy', 'desert', 'green_area', 'water']
|
9 |
+
|
10 |
+
def predict_image(img):
|
11 |
+
img = img.resize((128,128))
|
12 |
+
img_array = np.array(img)/255.0
|
13 |
+
img_array = np.expand_dims(img_array, axis=0)
|
14 |
+
|
15 |
+
predictions = model.predict(img_array)
|
16 |
+
predicted_class = class_names[np.argmax(predictions)]
|
17 |
+
confidence = np.max(predictions)
|
18 |
+
|
19 |
+
return f"{predicted_class} ({confidence*100:.2f}%)"
|
20 |
+
|
21 |
+
iface = gr.Interface(
|
22 |
+
fn=predict_image,
|
23 |
+
inputs=gr.Image(type="pil"),
|
24 |
+
outputs="text",
|
25 |
+
title="Satellite Image Classifier",
|
26 |
+
description="Upload a satellite image and the model will predict its class (cloudy, desert, green_area, water)."
|
27 |
+
)
|
28 |
+
|
29 |
+
iface.launch(share=False)
|
requirements.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
numpy
|
2 |
+
pandas
|
3 |
+
matplotlib
|
4 |
+
seaborn
|
5 |
+
tensorflow
|
6 |
+
keras
|
static_cnn_colab_final.keras
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e7871fb47c237ba9f6d55b3ae76a47ebfe8d12374e77322f6e85918c78ceadae
|
3 |
+
size 78258434
|