ebgoldstein commited on
Commit
e273c8a
·
verified ·
1 Parent(s): 3cddee9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -37,11 +37,12 @@ def FRFsegment(input_img):
37
  # Model prediction
38
  est_label_dict = model(img)
39
 
40
- # Extract the actual tensor from the dictionary
41
- if isinstance(est_label_dict, dict):
42
- est_label = est_label_dict['serving_default'] # Use the appropriate key
43
- else:
44
- est_label = est_label_dict
 
45
 
46
  # Check the shape of the predicted output
47
  if len(est_label.shape) == 4 and est_label.shape[-1] > 1:
@@ -86,4 +87,3 @@ FRFSegapp = gr.Interface(
86
 
87
  FRFSegapp.launch()
88
 
89
-
 
37
  # Model prediction
38
  est_label_dict = model(img)
39
 
40
+ # Print available keys to understand what we are dealing with
41
+ print("Available keys in the output dictionary:", est_label_dict.keys())
42
+
43
+ # Extract the actual tensor from the dictionary using a dynamic key lookup
44
+ key = list(est_label_dict.keys())[0] # Use the first available key
45
+ est_label = est_label_dict[key]
46
 
47
  # Check the shape of the predicted output
48
  if len(est_label.shape) == 4 and est_label.shape[-1] > 1:
 
87
 
88
  FRFSegapp.launch()
89