Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -95,12 +95,12 @@ outputs = [gr.Dataframe(
|
|
95 |
def infer(inputs):
|
96 |
data = pd.DataFrame(inputs, columns=headers)
|
97 |
|
|
|
|
|
|
|
98 |
# Replace empty strings with NaN
|
99 |
data = data.replace('', np.nan)
|
100 |
|
101 |
-
# Store the Name column
|
102 |
-
names = data['Name'].copy()
|
103 |
-
|
104 |
# Add missing columns with default values
|
105 |
for col in all_headers:
|
106 |
if col not in data.columns:
|
@@ -119,7 +119,7 @@ def infer(inputs):
|
|
119 |
# Make predictions
|
120 |
predictions = pipe.predict(data)
|
121 |
|
122 |
-
# Create output DataFrame with
|
123 |
return pd.DataFrame({
|
124 |
'Name': names,
|
125 |
'Depression': predictions
|
@@ -127,6 +127,7 @@ def infer(inputs):
|
|
127 |
|
128 |
|
129 |
|
|
|
130 |
gr.Interface(
|
131 |
fn=infer,
|
132 |
inputs=inputs,
|
|
|
95 |
def infer(inputs):
|
96 |
data = pd.DataFrame(inputs, columns=headers)
|
97 |
|
98 |
+
# Store the Name column first, before any processing
|
99 |
+
names = data['Name'].copy()
|
100 |
+
|
101 |
# Replace empty strings with NaN
|
102 |
data = data.replace('', np.nan)
|
103 |
|
|
|
|
|
|
|
104 |
# Add missing columns with default values
|
105 |
for col in all_headers:
|
106 |
if col not in data.columns:
|
|
|
119 |
# Make predictions
|
120 |
predictions = pipe.predict(data)
|
121 |
|
122 |
+
# Create output DataFrame with stored names and predictions
|
123 |
return pd.DataFrame({
|
124 |
'Name': names,
|
125 |
'Depression': predictions
|
|
|
127 |
|
128 |
|
129 |
|
130 |
+
|
131 |
gr.Interface(
|
132 |
fn=infer,
|
133 |
inputs=inputs,
|