Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wonyeong #22

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion BE/green_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def get_LLM_response(code_data: str):


def execute_java_code(code: str):
code = code.replace('\u00a0', ' ')
code = code.replace('\u00A0', ' ')
code = code.replace("\xc2\xa0", " ")
match = re.search(r'public\s+class\s+(\w+)', code)
if not match:
class_name = "NoClassName"
Expand Down Expand Up @@ -78,6 +79,7 @@ def execute_java_code(code: str):
def calculate_carbon_footprint(runtime: float):
energy_needed = runtime * (POWER_DRAW_FOR_CPU * USAGE + POWER_DRAW_FOR_MEMORY_PER_GB ) * PUE * PSF
carbon_footprint = energy_needed * CARBON_INTENSITY
carbon_footprint = carbon_footprint / 3600
return carbon_footprint


Expand Down