mewton commited on
Commit
e99c6a8
·
verified ·
1 Parent(s): 501dbc0

Upload 4 files

Browse files

git anjing nyusahin

Files changed (4) hide show
  1. app.py +26 -0
  2. model_deri.h5 +3 -0
  3. requirements.txt +4 -0
  4. xception_deri.h5 +3 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import cv2
3
+ import numpy as np
4
+ from tensorflow.keras.models import load_model
5
+
6
+ # Load model
7
+ model = load_model("xception_deri.h5")
8
+
9
+ def predict_image(image):
10
+ img = cv2.resize(image, (128, 128))
11
+ img = img / 255.0
12
+ img = np.expand_dims(img, axis=0)
13
+
14
+ prediction = model.predict(img)[0][0]
15
+ label = "Ini Deri" if prediction > 0.5 else "Ini bukan Deri"
16
+ return label, float(prediction)
17
+
18
+ iface = gr.Interface(
19
+ fn=predict_image,
20
+ inputs=gr.Image(type="numpy"),
21
+ outputs=[gr.Label(), gr.Number()],
22
+ title="Deri Classifier",
23
+ description="Upload gambar dan model akan memprediksi apakah itu Deri atau bukan."
24
+ )
25
+
26
+ iface.launch()
model_deri.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a6238ea2b4d390daadb6bda4bd359bd481da6a733e9740f2b0594a002b2a0cc
3
+ size 39712160
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ tensorflow==2.10
2
+ opencv-python
3
+ numpy
4
+ gradio
xception_deri.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac6a26cb2fcc03102c46dd2f7736c70d8d944d57480d0487d2e775a3d77596a2
3
+ size 87014712