GiladtheFixer commited on
Commit
326b6bc
1 Parent(s): b579023
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -1,14 +1,16 @@
1
  import numpy as np
2
  import tensorflow as tf
3
- import gradio as gr
4
  from tensorflow.keras.optimizers import Adam
5
  from huggingface_hub import from_pretrained_keras
6
 
7
- reloaded_model = from_pretrained_keras('ShaharAdar/best-model-try')
 
 
 
 
8
  reloaded_model.compile(optimizer=Adam(0.00001),
9
  loss='categorical_crossentropy',
10
- metrics=['accuracy']
11
- )
12
 
13
  def classify_image(image):
14
  # Resize the image to 224x224 as expected by your model
@@ -35,4 +37,4 @@ import gradio as gr
35
  iface = gr.Interface(fn=classify_image, inputs="image", outputs="text")
36
 
37
  # Launch the application
38
- iface.launch()
 
1
  import numpy as np
2
  import tensorflow as tf
 
3
  from tensorflow.keras.optimizers import Adam
4
  from huggingface_hub import from_pretrained_keras
5
 
6
+ # Load the model and its configuration
7
+ model_dict = from_pretrained_keras('ShaharAdar/best-model-try')
8
+ reloaded_model = model_dict['model']
9
+
10
+ # Compile the model
11
  reloaded_model.compile(optimizer=Adam(0.00001),
12
  loss='categorical_crossentropy',
13
+ metrics=['accuracy'])
 
14
 
15
  def classify_image(image):
16
  # Resize the image to 224x224 as expected by your model
 
37
  iface = gr.Interface(fn=classify_image, inputs="image", outputs="text")
38
 
39
  # Launch the application
40
+ iface.launch()