File size: 2,195 Bytes
835d453
 
 
 
caeec9b
835d453
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7e5338f
 
835d453
 
 
 
2cab386
835d453
 
 
 
 
 
 
 
c3be3d1
b5b4a97
 
 
 
7e5338f
c3be3d1
 
 
 
7e5338f
 
 
b5b4a97
835d453
16a6507
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import gradio as gr
import pandas as pd
import numpy as np
import pickle
import sklearn
model = pickle.load(open('random_forest_regression_model.pkl', 'rb'))

import gradio as gr
def car(Year,owners,sp,fuel,distance,tyype,trans):
  if fuel =="PETROL":
    p,d=1,0
  if fuel =="DIESEL":
    p,d=0,1
  if fuel =="CNG":
    p,d=0,0
  year = 2022-Year
  if tyype=="Individual":
    st=1
  else:
    st=0
  if trans=="Manual":
    t=1
  else:
    t=0
  error = "ใ€ ๐—˜๐—ฟ๐—ฟ๐—ผ๐—ฟ ๐Ÿฐ๐Ÿฌ๐Ÿฐ : ๐—ฉ๐—ฎ๐—น๐˜‚๐—ฒ ๐— ๐—ถ๐˜€๐˜€๐—ถ๐—ป๐—ด ใ€‘"
  prediction=model.predict([[sp,distance,owners,year,d,p,st,t]])
  output=round(prediction[0],2)
  ou= str(output)
  if Year==0 or distance==0 or sp==0:
    return error
  else:
    return "The Price of Will be  โ‚น" + ou  + "L !"
# face = gr.Interface(fn=start, inputs=["text", "checkbox","N", gr.inputs.Slider(0, 100),gr.inputs.Radio(["add", "subtract", "multiply"])], outputs=["text", "number"])
# face.launch()
ts= """ 
Used Car  Price  Prediction"""
# ---------------------------------INPUTS :------------------------------

# in1=gr.inputs.Textbox(placeholder="En",label="MO")
in2=gr.inputs.Number(label='Which Model (Year)ใ€*ใ€‘',default=0)
in3= gr.inputs.Slider(0, 10,1,label="No. of Previous Owners eg.1,2,3")
in4=gr.inputs.Number(label='Kilometeres Drivedใ€*ใ€‘',default=0)
in5= gr.inputs.Radio(["PETROL", "DIESEL", "CNG"])
in6=gr.inputs.Dropdown(["Individual", "Dealer"],label="You Are")
in7=gr.inputs.Dropdown(["Automatic", "Manual"],label="Transmission Type")
in8=gr.inputs.Number(label='Showroom Price โ‚น(in LAKHS)ใ€*ใ€‘',default=0)

interface = gr.Interface(fn=car,
                         inputs=[in2,in3,in8,in5,in4,in6,in7],
                         outputs=["text"],title=ts,theme="peach",css="""
                         .gradio_bg[theme=default] .gradio_interface .panel_button.submit {

	background-color: rgba(99, 102, 241, var(--tw-bg-opacity));

}
.gradio_bg[theme=peach] .gradio_interface .panel_header {
  font-family: Arial, Helvetica, sans-serif;;
  font-size: 17px;
}
.gradio_page .title{
  font-family: "Copperplate",Fantasy;
  font-size: 47px;
}"""
                         )
interface.launch(inline=False)