ericjedha commited on
Commit
9292616
·
verified ·
1 Parent(s): cfef830

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -6,7 +6,7 @@ import tensorflow as tf
6
  import keras
7
  from keras.models import Model
8
  from keras.preprocessing import image
9
- from tensorflow.keras.preprocessing import image
10
  from huggingface_hub import hf_hub_download
11
  import pandas as pd
12
  from PIL import Image
@@ -172,16 +172,16 @@ def predict_single(img_input, weights=(0.45, 0.25, 0.3), normalize=True):
172
  # Chargement et pré-traitement avec Keras (comme en local)
173
  if isinstance(img_input, str):
174
  img_path = img_input
175
- img_raw_x = image.load_img(img_path, target_size=(299, 299), interpolation="bilinear")
176
- img_raw_r = image.load_img(img_path, target_size=(224, 224), interpolation="bilinear")
177
- img_raw_d = image.load_img(img_path, target_size=(224, 224), interpolation="bilinear")
178
  else:
179
  # Cas d'upload via interface Gradio
180
  temp_path = "temp_debug_image.jpg"
181
  img_input.save(temp_path)
182
- img_raw_x = image.load_img(temp_path, target_size=(299, 299), interpolation="bilinear")
183
- img_raw_r = image.load_img(temp_path, target_size=(224, 224), interpolation="bilinear")
184
- img_raw_d = image.load_img(temp_path, target_size=(224, 224), interpolation="bilinear")
185
  import os
186
  os.remove(temp_path)
187
 
 
6
  import keras
7
  from keras.models import Model
8
  from keras.preprocessing import image
9
+ #from tensorflow.keras.preprocessing import image
10
  from huggingface_hub import hf_hub_download
11
  import pandas as pd
12
  from PIL import Image
 
172
  # Chargement et pré-traitement avec Keras (comme en local)
173
  if isinstance(img_input, str):
174
  img_path = img_input
175
+ img_raw_x = image.load_img(img_path, target_size=(299, 299))
176
+ img_raw_r = image.load_img(img_path, target_size=(224, 224))
177
+ img_raw_d = image.load_img(img_path, target_size=(224, 224))
178
  else:
179
  # Cas d'upload via interface Gradio
180
  temp_path = "temp_debug_image.jpg"
181
  img_input.save(temp_path)
182
+ img_raw_x = image.load_img(temp_path, target_size=(299, 299))
183
+ img_raw_r = image.load_img(temp_path, target_size=(224, 224))
184
+ img_raw_d = image.load_img(temp_path, target_size=(224, 224))
185
  import os
186
  os.remove(temp_path)
187