Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ from tensorflow.keras.models import load_model
|
|
3 |
import gradio as gr
|
4 |
import cv2
|
5 |
import numpy as np
|
6 |
-
from tensorflow.keras.applications.
|
7 |
import gdown
|
8 |
|
9 |
# Download model dari Google Drive
|
@@ -29,13 +29,13 @@ acne_treatment = {
|
|
29 |
# Fungsi untuk mendeteksi acne
|
30 |
def detect_acne(image, threshold=0.4):
|
31 |
# Resize gambar menjadi 224x224 piksel agar sesuai dengan ukuran input model
|
32 |
-
image_resized = cv2.resize(image, (
|
33 |
|
34 |
# Proses gambar dengan preprocess_input untuk menyesuaikan format input model
|
35 |
input_data = preprocess_input(np.expand_dims(image_resized, axis=0)) # Menambah dimensi untuk batch
|
36 |
|
37 |
# Mendapatkan prediksi dari model
|
38 |
-
predictions =
|
39 |
|
40 |
# Menemukan indeks kelas dengan probabilitas tertinggi
|
41 |
max_index = np.argmax(predictions[0]) # Indeks dengan probabilitas tertinggi
|
|
|
3 |
import gradio as gr
|
4 |
import cv2
|
5 |
import numpy as np
|
6 |
+
from tensorflow.keras.applications.inception_v3 import InceptionV3
|
7 |
import gdown
|
8 |
|
9 |
# Download model dari Google Drive
|
|
|
29 |
# Fungsi untuk mendeteksi acne
|
30 |
def detect_acne(image, threshold=0.4):
|
31 |
# Resize gambar menjadi 224x224 piksel agar sesuai dengan ukuran input model
|
32 |
+
image_resized = cv2.resize(image, (299, 299))
|
33 |
|
34 |
# Proses gambar dengan preprocess_input untuk menyesuaikan format input model
|
35 |
input_data = preprocess_input(np.expand_dims(image_resized, axis=0)) # Menambah dimensi untuk batch
|
36 |
|
37 |
# Mendapatkan prediksi dari model
|
38 |
+
predictions = acneModel.predict(input_data)
|
39 |
|
40 |
# Menemukan indeks kelas dengan probabilitas tertinggi
|
41 |
max_index = np.argmax(predictions[0]) # Indeks dengan probabilitas tertinggi
|