Certainly! Here's the step-by-step tutorial on how to test your FastAPI API endpoint using Insomnia:

---

### **Prerequisites**
- Your FastAPI application is up and running.
- Insomnia is installed on your computer.

---

### **Step 1: Start Your FastAPI Application**
Before testing, ensure your FastAPI app is running:

1. Navigate to your project directory in the terminal.
2. Activate your virtual environment (if you have one):

    - **On Windows:**
      ```bash
      venv\Scripts\activate
      ```
    - **On macOS/Linux:**
      ```bash
      source venv/bin/activate
      ```

3. Start the FastAPI server using Uvicorn:
   ```bash
   uvicorn app.main:app --reload
   ```
   - Ensure the path `app.main:app` points to your FastAPI application.
   - The `--reload` flag auto-restarts the server when code changes.

4. Verify the server is running; you should see:
   ```plaintext
   INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
   ```

---

### **Step 2: Open Insomnia**
1. Download and install [Insomnia](https://insomnia.rest/download).
2. Launch Insomnia.

---

### **Step 3: Create a New Request**
1. Click on the "+" button in the top-left corner.
2. Select "Request" from the dropdown menu.
3. Name your request (e.g., **Predict House Price**).
4. Set request type to **POST**.
5. Place it in a new/existing folder (optional) and click **Create**.

---

### **Step 4: Configure the Request URL**
1. Enter the API endpoint URL:
   ```plaintext
   http://localhost:8000/predict
   ```

---

### **Step 5: Set Request Headers**
1. Click on the **Headers** tab.
2. Add a new header:
   - **Key:** `Content-Type`
   - **Value:** `application/json`

---

### **Step 6: Construct the Request Body**
1. Click on the **Body** tab.
2. Select **JSON** from the body types.
3. Enter the JSON data your API expects, e.g.:
   ```json
   {
     "longitude": -122.23,
     "latitude": 37.88,
     "housing_median_age": 41.0,
     "total_rooms": 880,
     "total_bedrooms": 129,
     "population": 322,
     "households": 126,
     "median_income": 8.3252,
     "rooms_per_household": 6.984127,
     "bedrooms_per_room": 0.146591,
     "population_per_household": 2.555556,
     "ocean_proximity_INLAND": 0,
     "ocean_proximity_ISLAND": 0,
     "ocean_proximity_NEAR_BAY": 1,
     "ocean_proximity_NEAR_OCEAN": 0,
     "ocean_proximity_1H_OCEAN": 0
   }
   ```

---

### **Step 7: Send the Request**
1. Click on the **Send** button (paper plane icon) to submit the request.

---

### **Step 8: Review the Response**
- After sending, check the response section.
- A successful response should look like:
  ```json
  {
    "predicted_house_value": 452600.0
  }
  ```

---

### **Troubleshooting Common Issues**

- **Issue 1: Server Not Running**
   - Error: "Could not connect to server" or "Connection refused".
   - Solution: Ensure the FastAPI server is running and the URL is correct.

- **Issue 2: Validation Errors**
   - Error: Missing fields in the response.
   - Solution: Ensure all required fields are included in the JSON body.

- **Issue 3: Incorrect Data Types**
   - Error: Data type mismatch.
   - Solution: Match the data types with the Pydantic model (e.g., floats for numbers).

- **Issue 4: Model Prediction Errors**
   - Error: Server error related to model prediction.
   - Solution: Check if the model and scaler files are correctly loaded.

---

### **Testing with Different Data**
You can modify the JSON input to test different cases:
```json
{
  "longitude": -118.25,
  "latitude": 34.05,
  "housing_median_age": 30.0,
  "total_rooms": 5000,
  "total_bedrooms": 1000,
  "population": 3000,
  "households": 1200,
  "median_income": 5.0,
  "rooms_per_household": 4.1667,
  "bedrooms_per_room": 0.2,
  "population_per_household": 2.5,
  "ocean_proximity_INLAND": 1,
  "ocean_proximity_ISLAND": 0,
  "ocean_proximity_NEAR_BAY": 0,
  "ocean_proximity_NEAR_OCEAN": 0,
  "ocean_proximity_1H_OCEAN": 0
}
```

---

### **Using FastAPI's Interactive Docs**
FastAPI auto-generates Swagger documentation:

1. Navigate to: `http://localhost:8000/docs`
2. Find your `/predict` endpoint.
3. Click "Try it out" and fill in the request body fields.
4. Click "Execute" to send the request and review the response.

---

### **Tips for a Successful Test**
- **Consistency**: The order of fields in the JSON doesn't matter, but the names and types must match.
- **Logger Output**: Check the terminal for error messages during the request.

---

### **Possible Enhancements**
- **Default Values**: Add default values for optional fields.
- **Input Validation**: Implement custom validation for input ranges.
- **Error Handling**: Use `try-except` blocks for graceful error handling.

---

### **Conclusion**
By following these steps, you can successfully test your FastAPI endpoint using Insomnia. This ensures that your API and machine learning model work as expected.

If you have any further issues, feel free to ask!


Q- i do it like you have done exactly but i get this error 
500 Internal Server Error

 File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\sklearn\preprocessing\_data.py", line 1045, in transform
    X = self._validate_data(
        ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\sklearn\base.py", line 608, in _validate_data   
    self._check_feature_names(X, reset=reset)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\sklearn\base.py", line 535, in _check_feature_names
    raise ValueError(message)
ValueError: The feature names should match those that were passed during fit.
Feature names unseen at fit time:
- ocean_proximity_1H_OCEAN
- ocean_proximity_NEAR_BAY
- ocean_proximity_NEAR_OCEAN
Feature names seen at fit time, yet now missing:
- ocean_proximity_<1H OCEAN
- ocean_proximity_NEAR BAY
- ocean_proximity_NEAR OCEAN

INFO:     Shutting down
INFO:     Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:     Finished server process [46920]
INFO:     Stopping reloader process [15516]
PS C:\Users\PCS\Desktop\mlops\P_mlops> uvicorn app.main:app --reload
INFO:     Will watch for changes in these directories: ['C:\\Users\\PCS\\Desktop\\mlops\\P_mlops']
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [20048] using StatReload
INFO:     Started server process [20808]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     127.0.0.1:55794 - "POST /predict HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 406, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 60, in __call__
    return await self.app(scope, receive, send)      
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^      
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\fastapi\applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)     
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\applications.py", line 113, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\middleware\errors.py", line 187, in __call__
    raise exc
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\middleware\errors.py", line 165, in __call__
    await self.app(scope, receive, _send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\_exception_handler.py", line 62, in wrapped_app
    raise exc
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\routing.py", line 715, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\routing.py", line 735, in app 
    await route.handle(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\routing.py", line 288, in handle
    await self.app(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\routing.py", line 76, in app  
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\_exception_handler.py", line 62, in wrapped_app
    raise exc
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\routing.py", line 73, in app  
    response = await f(request)
               ^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\fastapi\routing.py", line 301, in app   
    raw_response = await run_endpoint_function(      
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^      
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\fastapi\routing.py", line 214, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\concurrency.py", line 39, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 2405, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 914, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\app\main.py", line 47, in predict
    input_scaled = scaler.transform(input_df)        
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^        
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\sklearn\utils\_set_output.py", line 316, in wrapped
    data_to_wrap = f(self, X, *args, **kwargs)       
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^       
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\sklearn\preprocessing\_data.py", line 1045, in transform
    X = self._validate_data(
        ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\sklearn\base.py", line 608, in _validate_data
    self._check_feature_names(X, reset=reset)        
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\sklearn\base.py", line 535, in _check_feature_names
    raise ValueError(message)
ValueError: The feature names should match those that were passed during fit.
Feature names unseen at fit time:
- ocean_proximity_1H_OCEAN
- ocean_proximity_NEAR_BAY
- ocean_proximity_NEAR_OCEAN
Feature names seen at fit time, yet now missing:
- ocean_proximity_<1H OCEAN
- ocean_proximity_NEAR BAY
- ocean_proximity_NEAR OCEAN

INFO:     127.0.0.1:55945 - "POST /predict HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 406, in run_asgi  
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 60, in __call__  
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\fastapi\applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\applications.py", line 113, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\middleware\errors.py", line 187, in __call__      
    raise exc
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\middleware\errors.py", line 165, in __call__      
    await self.app(scope, receive, _send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in __call__   
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\_exception_handler.py", line 62, in wrapped_app   
    raise exc
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\_exception_handler.py", line 51, in wrapped_app   
    await app(scope, receive, sender)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\routing.py", line 715, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\routing.py", line 735, in app
    await route.handle(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\routing.py", line 288, in handle
    await self.app(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\routing.py", line 76, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\_exception_handler.py", line 62, in wrapped_app   
    raise exc
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\_exception_handler.py", line 51, in wrapped_app   
    await app(scope, receive, sender)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\routing.py", line 73, in app
    response = await f(request)
               ^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\fastapi\routing.py", line 301, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\fastapi\routing.py", line 214, in run_endpoint_function     
    return await run_in_threadpool(dependant.call, **values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\concurrency.py", line 39, in run_in_threadpool    
    return await anyio.to_thread.run_sync(func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 2405, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 914, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\app\main.py", line 47, in predict
    input_scaled = scaler.transform(input_df)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\sklearn\utils\_set_output.py", line 316, in wrapped
    data_to_wrap = f(self, X, *args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\sklearn\preprocessing\_data.py", line 1045, in transform    
    X = self._validate_data(
        ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\sklearn\base.py", line 608, in _validate_data
    self._check_feature_names(X, reset=reset)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\sklearn\base.py", line 535, in _check_feature_names
    raise ValueError(message)
ValueError: The feature names should match those that were passed during fit.
Feature names unseen at fit time:
- ocean_proximity_1H_OCEAN
- ocean_proximity_NEAR_BAY
- ocean_proximity_NEAR_OCEAN
Feature names seen at fit time, yet now missing:
- ocean_proximity_<1H OCEAN
- ocean_proximity_NEAR BAY
- ocean_proximity_NEAR OCEAN

INFO:     127.0.0.1:55957 - "GET /docs HTTP/1.1" 200 OK
INFO:     127.0.0.1:55957 - "GET /openapi.json HTTP/1.1" 200 OK
INFO:     127.0.0.1:55975 - "POST /predict HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 406, in run_asgi  
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 60, in __call__  
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\fastapi\applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\applications.py", line 113, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\middleware\errors.py", line 187, in __call__      
    raise exc
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\middleware\errors.py", line 165, in __call__      
    await self.app(scope, receive, _send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in __call__   
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\_exception_handler.py", line 62, in wrapped_app   
    raise exc
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\_exception_handler.py", line 51, in wrapped_app   
    await app(scope, receive, sender)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\routing.py", line 715, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\routing.py", line 735, in app
    await route.handle(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\routing.py", line 288, in handle
    await self.app(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\routing.py", line 76, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\_exception_handler.py", line 62, in wrapped_app   
    raise exc
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\_exception_handler.py", line 51, in wrapped_app   
    await app(scope, receive, sender)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\routing.py", line 73, in app
    response = await f(request)
               ^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\fastapi\routing.py", line 301, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\fastapi\routing.py", line 214, in run_endpoint_function     
    return await run_in_threadpool(dependant.call, **values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\starlette\concurrency.py", line 39, in run_in_threadpool    
    return await anyio.to_thread.run_sync(func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 2405, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 914, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\app\main.py", line 47, in predict
    input_scaled = scaler.transform(input_df)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\sklearn\utils\_set_output.py", line 316, in wrapped
    data_to_wrap = f(self, X, *args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\sklearn\preprocessing\_data.py", line 1045, in transform    
    X = self._validate_data(
        ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\sklearn\base.py", line 608, in _validate_data
    self._check_feature_names(X, reset=reset)
  File "C:\Users\PCS\Desktop\mlops\P_mlops\venv\Lib\site-packages\sklearn\base.py", line 535, in _check_feature_names
    raise ValueError(message)
ValueError: The feature names should match those that were passed during fit.
Feature names unseen at fit time:
- ocean_proximity_1H_OCEAN
- ocean_proximity_NEAR_BAY
- ocean_proximity_NEAR_OCEAN
Feature names seen at fit time, yet now missing:
- ocean_proximity_<1H OCEAN
- ocean_proximity_NEAR BAY
- ocean_proximity_NEAR OCEAN

$
Q- my question why and how to solve it