ajflorez commited on
Commit
7027c1b
Β·
verified Β·
1 Parent(s): 545ad83

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -37,6 +37,7 @@ def load_plan_vi(mapa_seleccionado, uploaded_file):
37
  if mapa_seleccionado == "Upload your own image" and uploaded_file is not None:
38
  plan_image = Image.open(uploaded_file.name)
39
  elif mapa_seleccionado == "Upload your own image" and uploaded_file is None:
 
40
  image_plan_path1 = os.path.join(images_file, "100.JPG")
41
  plan_image = Image.open(image_plan_path1)
42
  else:
@@ -169,12 +170,14 @@ def main_function(plan_name, uploaded_file, interference = True, aps_int = 0, ap
169
 
170
  dimensiones = plan_image.shape
171
  if dimensiones[0] != 256 or dimensiones[1] != 256 or dimensiones[3] != 3:
 
172
  raise ValueError("Error in image size. Must [256,256,3].")
173
 
174
  plan_grayscale = plan_image[:, :, 0]
175
  plan_in = 1 - plan_grayscale
176
 
177
  elif plan_name == "Upload your own image" and uploaded_file is None:
 
178
  numero = "100"
179
  plan_in = np.array(Image.open(f"{path_main}Scennarios init/Scennarios B/{numero}.png")) / 255
180
 
@@ -188,6 +191,9 @@ def main_function(plan_name, uploaded_file, interference = True, aps_int = 0, ap
188
  dimension = 256
189
 
190
  if interference:
 
 
 
191
  channels_c = [1, 6 , 11]
192
  channels = 3
193
  num_APs = np.zeros(channels, dtype=int)
 
37
  if mapa_seleccionado == "Upload your own image" and uploaded_file is not None:
38
  plan_image = Image.open(uploaded_file.name)
39
  elif mapa_seleccionado == "Upload your own image" and uploaded_file is None:
40
+ raise gradio.Warning("Deafult plan. Image was not loaded πŸ˜’.", duration=5)
41
  image_plan_path1 = os.path.join(images_file, "100.JPG")
42
  plan_image = Image.open(image_plan_path1)
43
  else:
 
170
 
171
  dimensiones = plan_image.shape
172
  if dimensiones[0] != 256 or dimensiones[1] != 256 or dimensiones[3] != 3:
173
+ raise gradio.Error("Error in dimensions of the uploaded image. Must [256,256,3] πŸ’£πŸŽ†.", duration=5)
174
  raise ValueError("Error in image size. Must [256,256,3].")
175
 
176
  plan_grayscale = plan_image[:, :, 0]
177
  plan_in = 1 - plan_grayscale
178
 
179
  elif plan_name == "Upload your own image" and uploaded_file is None:
180
+ raise gradio.Warning("Deafult plan processed. Image was not loaded πŸ˜’.", duration=5)
181
  numero = "100"
182
  plan_in = np.array(Image.open(f"{path_main}Scennarios init/Scennarios B/{numero}.png")) / 255
183
 
 
191
  dimension = 256
192
 
193
  if interference:
194
+ if apch1 == 0 and apch6 == 0 and apch11 == 0:
195
+ raise gradio.Warning("There are not APs for estimation πŸ˜’.", duration=5)
196
+
197
  channels_c = [1, 6 , 11]
198
  channels = 3
199
  num_APs = np.zeros(channels, dtype=int)