diff --git a/BE/green_function.py b/BE/green_function.py index ca4616e..2f552fc 100644 --- a/BE/green_function.py +++ b/BE/green_function.py @@ -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" @@ -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