# Car Price Prediction App ## Overview This application is a simple web interface for predicting car prices based on various features. It utilizes a machine learning model (Random Forest Regressor) trained on a dataset of car attributes such as brand, model year, engine size, mileage, fuel type, transmission, and owner count. The goal is to provide an estimated selling price for a given car. ## How to Use 1. **Launch the Application**: Run the `app.py` script. If deploying on Hugging Face Spaces, it will be automatically launched. 2. **Input Car Features**: Use the interactive sliders and dropdowns in the Gradio interface to select the desired features for the car you want to predict the price for: * **Brand**: Select the car's brand from the dropdown. * **Model Year**: Adjust the slider to set the model year. * **Engine Size (L)**: Set the engine size in liters. * **Mileage (km)**: Input the car's total mileage. * **Fuel Type**: Choose the fuel type (Petrol, Diesel, Hybrid). * **Transmission**: Select the transmission type (Manual, Automatic). * **Owner Count**: Specify the number of previous owners. 3. **Get Prediction**: Click the 'Submit' button (or equivalent in the Gradio interface) to see the predicted selling price displayed in the output box. ## Model and Data The core of this application is a Random Forest Regressor model trained on car listing data. The model was trained using features like `brand`, `model_year`, `engine_size`, `mileage`, `fuel_type`, `transmission`, and `owner_count` to predict the `price`. Preprocessing steps included: * Handling missing values (imputation with median for numerical and mode for categorical). * One-Hot Encoding for categorical features (`brand`, `fuel_type`, `transmission`). * Standard Scaling for numerical features (`model_year`, `engine_size`, `mileage`). ## Deployment on Hugging Face Spaces To deploy this application on Hugging Face Spaces, you will need the following files in your repository: * `app.py`: The main Gradio application script. * `requirements.txt`: Lists all Python dependencies (`gradio`, `pandas`, `scikit-learn`, `joblib`). * `car_price_model.pkl`: The trained Random Forest Regressor model. * `encoder.pkl`: The fitted OneHotEncoder used for categorical features. * `scaler.pkl`: The fitted StandardScaler used for numerical features. Ensure these files are in the root directory of your Hugging Face Space. Hugging Face will automatically detect `app.py` and run the application in a Gradio interface.