Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import joblib
|
3 |
import numpy as np
|
|
|
4 |
|
5 |
# Load the model and unique brand values
|
6 |
model = joblib.load('model.joblib')
|
@@ -15,7 +16,12 @@ def predict(brand, screen_size, resolution_width, resolution_height):
|
|
15 |
resolution_height = int(resolution_height)
|
16 |
|
17 |
# Prepare the input array for prediction
|
18 |
-
input_data =
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
# Perform the prediction
|
21 |
prediction = model.predict(input_data)
|
@@ -26,7 +32,7 @@ def predict(brand, screen_size, resolution_width, resolution_height):
|
|
26 |
interface = gr.Interface(
|
27 |
fn=predict,
|
28 |
inputs=[
|
29 |
-
gr.Dropdown(choices=brand_values, label="Brand"),
|
30 |
gr.Textbox(label="Screen Size"),
|
31 |
gr.Textbox(label="Resolution (Width)"),
|
32 |
gr.Textbox(label="Resolution (Height)")
|
|
|
1 |
import gradio as gr
|
2 |
import joblib
|
3 |
import numpy as np
|
4 |
+
import pandas as pd
|
5 |
|
6 |
# Load the model and unique brand values
|
7 |
model = joblib.load('model.joblib')
|
|
|
16 |
resolution_height = int(resolution_height)
|
17 |
|
18 |
# Prepare the input array for prediction
|
19 |
+
input_data = pd.DataFrame({
|
20 |
+
'Brand': [brand],
|
21 |
+
'Screen Size': [screen_size],
|
22 |
+
'Resolution (Width)': [resolution_width],
|
23 |
+
'Resolution (Height)': [resolution_height]
|
24 |
+
})
|
25 |
|
26 |
# Perform the prediction
|
27 |
prediction = model.predict(input_data)
|
|
|
32 |
interface = gr.Interface(
|
33 |
fn=predict,
|
34 |
inputs=[
|
35 |
+
gr.Dropdown(choices=list(brand_values), label="Brand"),
|
36 |
gr.Textbox(label="Screen Size"),
|
37 |
gr.Textbox(label="Resolution (Width)"),
|
38 |
gr.Textbox(label="Resolution (Height)")
|