Spaces:
Sleeping
Sleeping
Upload 5 files
Browse files- app.py +43 -0
- le_col.pkl +3 -0
- model.pkl +3 -0
- requirements.txt +5 -0
- std_col.pkl +3 -0
app.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import joblib
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
le=joblib.load('le_col.pkl')
|
| 7 |
+
scale=joblib.load('std_col.pkl')
|
| 8 |
+
lr=joblib.load('model.pkl')
|
| 9 |
+
|
| 10 |
+
le_col=['Prand']
|
| 11 |
+
std_col=['year','miles','condition']
|
| 12 |
+
|
| 13 |
+
def predicion_car_price(y,m,c,p):
|
| 14 |
+
try:
|
| 15 |
+
input_data=pd.DataFrame({
|
| 16 |
+
'year':[y],
|
| 17 |
+
'miles':[m],
|
| 18 |
+
'condition':[c],
|
| 19 |
+
'Prand':[p]
|
| 20 |
+
})
|
| 21 |
+
for col in le_col:
|
| 22 |
+
input_data[col]=le[col].transform(input_data[col])
|
| 23 |
+
input_data[std_col]=scale.transform(input_data[std_col])
|
| 24 |
+
prediction=lr.predict(input_data)
|
| 25 |
+
return prediction[0]
|
| 26 |
+
except Exception as e:
|
| 27 |
+
return str(e)
|
| 28 |
+
gr.Interface(
|
| 29 |
+
inputs=[
|
| 30 |
+
gr.Number(label='year'),
|
| 31 |
+
gr.Number(label='miles'),
|
| 32 |
+
gr.Number(label='condition'),
|
| 33 |
+
gr.Dropdown([
|
| 34 |
+
"Toyota", "Mercedes-Benz", "Ford", "Honda", "BMW", "Chevrolet", "Nissan", "Kia",
|
| 35 |
+
"Subaru", "Jeep", "Audi", "Volkswagen", "Hyundai", "Lexus", "Land", "Dodge", "Acura",
|
| 36 |
+
"Mazda", "Ram", "Volvo", "Porsche", "INFINITI", "Cadillac", "Chrysler", "GMC", "Alfa",
|
| 37 |
+
"Jaguar", "MINI", "Maserati", "Buick", "Lincoln", "Mitsubishi", "FIAT", "Scion",
|
| 38 |
+
"Aston", "Genesis", "Karma", "McLaren", "Rolls-Royce", "Bentley", "Pontiac", "Saturn"],label='Prand')
|
| 39 |
+
],
|
| 40 |
+
fn=predicion_car_price,
|
| 41 |
+
outputs=gr.Textbox(label='Prediction'),
|
| 42 |
+
title='Predictin_Car_Price'
|
| 43 |
+
).launch()
|
le_col.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:46f49f9f3e3dacf84fc7fa20a1939d53a924228be88e35e739baaaf40c63f1e2
|
| 3 |
+
size 1077
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f2b53d3c5ee7c3a1b704245817e74bc63e76fd5e9f9dc38556aecd70d80167cd
|
| 3 |
+
size 952
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pandas
|
| 2 |
+
numpy==1.23.5
|
| 3 |
+
scikit-learn==1.2.2
|
| 4 |
+
joblib
|
| 5 |
+
gradio
|
std_col.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ede2e423a303b80e17f056d3fdb88780eb6e69a0f17347b4af2be4b9402e2803
|
| 3 |
+
size 1007
|