danendradipa commited on
Commit
95580a9
·
verified ·
1 Parent(s): b60cafa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -2,15 +2,14 @@ import gradio as gr
2
  import tensorflow as tf
3
  import numpy as np
4
  from PIL import Image
5
- import spaces # Library wajib untuk tier ZeroGPU
6
 
7
- # Load model (tambahkan compile=False agar aman)
8
- model = tf.keras.models.load_model('cat_model.h5', compile=False)
9
 
10
  classes = ["Abyssinian", "Bengal", "Bombay", "British Shorthair", "Domestic",
11
  "Maine Coon", "Persian", "Ragdoll", "Siamese", "Sphynx"]
12
 
13
- # Dekorator ini wajib ada agar fungsinya bisa jalan di ZeroGPU
14
  @spaces.GPU
15
  def predict_cat(image):
16
  if image is None:
 
2
  import tensorflow as tf
3
  import numpy as np
4
  from PIL import Image
5
+ import spaces
6
 
7
+ # Load model dengan format .keras (format modern, bebas bug Flatten)
8
+ model = tf.keras.models.load_model('cat_model.keras')
9
 
10
  classes = ["Abyssinian", "Bengal", "Bombay", "British Shorthair", "Domestic",
11
  "Maine Coon", "Persian", "Ragdoll", "Siamese", "Sphynx"]
12
 
 
13
  @spaces.GPU
14
  def predict_cat(image):
15
  if image is None: