Spaces:
Sleeping
Sleeping
| import pandas as pd | |
| import gradio as gr | |
| import joblib | |
| le=joblib.load('le_col.pkl') | |
| scale=joblib.load('std_col.pkl') | |
| lr=joblib.load('model.pkl') | |
| le_col=['Prand'] | |
| std_col=['year','miles','condition'] | |
| def predicion_car_price(y,m,c,p): | |
| try: | |
| input_data=pd.DataFrame({ | |
| 'year':[y], | |
| 'miles':[m], | |
| 'condition':[c], | |
| 'Prand':[p] | |
| }) | |
| for col in le_col: | |
| input_data[col]=le[col].transform(input_data[col]) | |
| input_data[std_col]=scale.transform(input_data[std_col]) | |
| prediction=lr.predict(input_data) | |
| return prediction[0] | |
| except Exception as e: | |
| return str(e) | |
| gr.Interface( | |
| inputs=[ | |
| gr.Number(label='year'), | |
| gr.Number(label='miles'), | |
| gr.Number(label='condition'), | |
| gr.Dropdown([ | |
| "Toyota", "Mercedes-Benz", "Ford", "Honda", "BMW", "Chevrolet", "Nissan", "Kia", | |
| "Subaru", "Jeep", "Audi", "Volkswagen", "Hyundai", "Lexus", "Land", "Dodge", "Acura", | |
| "Mazda", "Ram", "Volvo", "Porsche", "INFINITI", "Cadillac", "Chrysler", "GMC", "Alfa", | |
| "Jaguar", "MINI", "Maserati", "Buick", "Lincoln", "Mitsubishi", "FIAT", "Scion", | |
| "Aston", "Genesis", "Karma", "McLaren", "Rolls-Royce", "Bentley", "Pontiac", "Saturn"],label='Prand') | |
| ], | |
| fn=predicion_car_price, | |
| outputs=gr.Textbox(label='Prediction'), | |
| title='Predictin_Car_Price' | |
| ).launch() |