Skip to content

felipeclarindo/energy-predict-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌍 Leia em Português

Energy Prediction API

This API is powered by a machine learning model that predicts total renewable energy based on data from different energy sources. The main objective is to help in the analysis of energy trends and promote sustainability through predictive insights.

Tecnologias

  • Python 3.x - Language used.
  • Flask - Creation of api.
  • scikit-learn - Creation of the machine learning model.
  • pickle - Serialization of the model.
  • pandas - Data handling.

API Endpoints

http://localhost:5000/api

Method: GET

Description: Return base description of api.

Response example:

{
  "status": "API is running",
  "description": "API para previsão de energia renovável",
  "version": "1.0.0",
  "creation_date": "2024-10-25",
  "technologies": ["Python 3.x", "Flask"],
  "endpoints": {
    "/api/": "Informações sobre a API (GET)",
    "/api/predict/": "Predição de energia renovável (POST)"
  }
}

http://localhost:5000/api/predict

Method: POST

Description: Receives data from energy sources and returns the forecast of total renewable energy.-

Expected Parameters (via query string):

  • year (int): Ano de referência.
  • hydroelectric_power (float): Consumo de energia hidrelétrica.
  • geothermal_energy (float): Consumo de energia geotérmica.
  • solar_energy (float): Consumo de energia solar.
  • wind_energy (float): Consumo de energia eólica.
  • biomass_energy (float): Consumo de energia de biomassa.

Example of Data Submission:

{
  "year": 2025,
  "hydroeletric_power": 1500.5,
  "geothermal_energy": 300.7,
  "solar_energy": 800.0,
  "wind_energy": 1200.4,
  "biomass_energy": 600.3
}

Response Example

{
  "Year": 2025,
  "Predicted Total Renewable Energy": 4401.9
}

Steps for installing and running.

  1. Clone the repository:
git clone https://github.com/felipeclarindo/energy-predict-api.git
  1. Enter directory:
cd energy-predict-api
  1. Create Virtual Environment:
python -m venv .venv
  1. Activate the Environment running .bat file: .venv/Scripts/activate.bat

  2. Install the dependencies:

pip install -r requirements.txt
  1. Rotate the jupyter cells from the file src/transition_energy_model.ipynb

  2. Run the api:

python src/api/api.py
  1. Api will be available at:
  • http://localhost:5000

Contribution

Contributions are welcome! If you have suggestions for improvements, feel free to open an issue or submit a pull request.

Author

Felipe Clarindo

License

This project is licensed under the GNU Affero License.

About

Api para realizar previsões sobre energia.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published