Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import numpy as np
|
|
5 |
# Load the model and unique brand values
|
6 |
model = joblib.load('model.joblib')
|
7 |
unique_values = joblib.load('unique_values.joblib')
|
8 |
-
brand_values = list(unique_values['Brand'])
|
9 |
|
10 |
# Define the prediction function
|
11 |
def predict(brand, screen_size, resolution_width, resolution_height):
|
@@ -14,8 +14,13 @@ def predict(brand, screen_size, resolution_width, resolution_height):
|
|
14 |
resolution_width = int(resolution_width)
|
15 |
resolution_height = int(resolution_height)
|
16 |
|
17 |
-
#
|
18 |
-
input_data =
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
# Perform the prediction
|
21 |
prediction = model.predict(input_data)
|
|
|
5 |
# Load the model and unique brand values
|
6 |
model = joblib.load('model.joblib')
|
7 |
unique_values = joblib.load('unique_values.joblib')
|
8 |
+
brand_values = list(unique_values['Brand']) # Gradio's dropdown only accpets a list
|
9 |
|
10 |
# Define the prediction function
|
11 |
def predict(brand, screen_size, resolution_width, resolution_height):
|
|
|
14 |
resolution_width = int(resolution_width)
|
15 |
resolution_height = int(resolution_height)
|
16 |
|
17 |
+
# Create a DataFrame with the input data
|
18 |
+
input_data = pd.DataFrame({
|
19 |
+
'Brand': [brand],
|
20 |
+
'Screen Size': [screen_size],
|
21 |
+
'Resolution (Width)': [resolution_width],
|
22 |
+
'Resolution (Height)': [resolution_height]
|
23 |
+
})
|
24 |
|
25 |
# Perform the prediction
|
26 |
prediction = model.predict(input_data)
|