Spaces:
Build error
Build error
Upload 3 files
Browse files- app.py +65 -0
- random_forest_regression_model.pkl +3 -0
- requirements.txt +1 -0
app.py
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import pandas as pd
|
3 |
+
import numpy as np
|
4 |
+
import pickle
|
5 |
+
import sklearn
|
6 |
+
model = pickle.load(open('random_forest_regression_model.pkl', 'rb'))
|
7 |
+
|
8 |
+
import gradio as gr
|
9 |
+
def car(Year,owners,sp,fuel,distance,tyype,trans):
|
10 |
+
if fuel =="PETROL":
|
11 |
+
p,d=1,0
|
12 |
+
if fuel =="DIESEL":
|
13 |
+
p,d=0,1
|
14 |
+
if fuel =="CNG":
|
15 |
+
p,d=0,0
|
16 |
+
year = 2022-Year
|
17 |
+
if tyype=="Individual":
|
18 |
+
st=1
|
19 |
+
else:
|
20 |
+
st=0
|
21 |
+
if trans=="Manual":
|
22 |
+
t=1
|
23 |
+
else:
|
24 |
+
t=0
|
25 |
+
error = "ใ ๐๐ฟ๐ฟ๐ผ๐ฟ ๐ฐ๐ฌ๐ฐ : ๐ฉ๐ฎ๐น๐๐ฒ ๐ ๐ถ๐๐๐ถ๐ป๐ด ใ"
|
26 |
+
prediction=model.predict([[sp,distance,owners,year,d,p,st,t]])
|
27 |
+
output=round(prediction[0],2)
|
28 |
+
ou= str(output)
|
29 |
+
if Year==0 or distance==0 or sp==0:
|
30 |
+
return error
|
31 |
+
else:
|
32 |
+
return "The Price of Will be โน" + ou + "L !"
|
33 |
+
# face = gr.Interface(fn=start, inputs=["text", "checkbox","N", gr.inputs.Slider(0, 100),gr.inputs.Radio(["add", "subtract", "multiply"])], outputs=["text", "number"])
|
34 |
+
# face.launch()
|
35 |
+
ts= """
|
36 |
+
Used Car Price Prediction"""
|
37 |
+
# ---------------------------------INPUTS :------------------------------
|
38 |
+
|
39 |
+
# in1=gr.inputs.Textbox(placeholder="En",label="MO")
|
40 |
+
in2=gr.inputs.Number(label='Which Model (Year)ใ*ใ',default=0)
|
41 |
+
in3= gr.inputs.Slider(0, 10,1,label="No. of Previous Owners eg.1,2,3")
|
42 |
+
in4=gr.inputs.Number(label='Kilometeres Drivedใ*ใ',default=0)
|
43 |
+
in5= gr.inputs.Radio(["PETROL", "DIESEL", "CNG"])
|
44 |
+
in6=gr.inputs.Dropdown(["Individual", "Dealer"],label="You Are")
|
45 |
+
in7=gr.inputs.Dropdown(["Automatic", "Manual"],label="Transmission Type")
|
46 |
+
in8=gr.inputs.Number(label='Showroom Price โน(in LAKHS)ใ*ใ',default=0)
|
47 |
+
|
48 |
+
interface = gr.Interface(fn=car,
|
49 |
+
inputs=[in2,in3,in8,in5,in4,in6,in7],
|
50 |
+
outputs=["text"],title=ts,theme="peach",css="""
|
51 |
+
.gradio_bg[theme=default] .gradio_interface .panel_button.submit {
|
52 |
+
|
53 |
+
background-color: rgba(99, 102, 241, var(--tw-bg-opacity));
|
54 |
+
|
55 |
+
}
|
56 |
+
.gradio_bg[theme=peach] .gradio_interface .panel_header {
|
57 |
+
font-family: Arial, Helvetica, sans-serif;;
|
58 |
+
font-size: 17px;
|
59 |
+
}
|
60 |
+
.gradio_page .title{
|
61 |
+
font-family: "Copperplate",Fantasy;
|
62 |
+
font-size: 47px;
|
63 |
+
}"""
|
64 |
+
)
|
65 |
+
interface.launch(inline=False)
|
random_forest_regression_model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:24163318b89fd4aa73abd40d0b3e908fac12d6aa69adaa30098f5d769c993123
|
3 |
+
size 16677984
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
sklearn
|