andromeda01111 commited on
Commit
a6e6be4
·
verified ·
1 Parent(s): 44ba96a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -91,10 +91,11 @@ def extract_features_from_file(file):
91
  content = file.read().decode("utf-8").strip()
92
  values = [float(x) for x in content.replace(",", " ").split()]
93
  if len(values) != 30:
94
- return " File must contain exactly 30 numbers."
95
- return {f"feature_{i}": values[i] for i in range(30)}
96
  except Exception as e:
97
- return f" Error: {e}"
 
98
 
99
  # --- UI with Gradio ---
100
  with gr.Blocks() as demo:
 
91
  content = file.read().decode("utf-8").strip()
92
  values = [float(x) for x in content.replace(",", " ").split()]
93
  if len(values) != 30:
94
+ raise ValueError("Expected 30 values, got {}".format(len(values)))
95
+ return values # must return a list of 30 floats
96
  except Exception as e:
97
+ print(f"Error reading file: {e}")
98
+ return [None] * 30 # return empty values for safety
99
 
100
  # --- UI with Gradio ---
101
  with gr.Blocks() as demo: