Spaces:
Sleeping
Sleeping
Ashmi Banerjee
commited on
Commit
·
0d6a282
1
Parent(s):
adbebe0
updated the code
Browse files
.config/.gitkeep
DELETED
File without changes
|
src/post_processing/post_process.py
CHANGED
@@ -2,7 +2,7 @@ from src.text_generation.text_generation import generate_response
|
|
2 |
|
3 |
|
4 |
def post_process_output(model_id: str, user_query: str, starting_point: str, response: str, context: dict, **params: dict) -> str | None:
|
5 |
-
if "s-fairness" in response.lower() or "score" in response.lower():
|
6 |
formatted_response = \
|
7 |
f"You are an AI recommendation system focused on sustainable travel. Rewrite this response without " \
|
8 |
f"mentioning the sustainability score or s-fairness.\n {response} "
|
|
|
2 |
|
3 |
|
4 |
def post_process_output(model_id: str, user_query: str, starting_point: str, response: str, context: dict, **params: dict) -> str | None:
|
5 |
+
if "s-fairness" in response.lower() or "score" in response.lower() or "sustainability data" in response.lower():
|
6 |
formatted_response = \
|
7 |
f"You are an AI recommendation system focused on sustainable travel. Rewrite this response without " \
|
8 |
f"mentioning the sustainability score or s-fairness.\n {response} "
|
src/text_generation/vertexai_setup.py
CHANGED
@@ -28,7 +28,7 @@ def initialize_vertexai_params(location: Optional[str] = "us-central1"):
|
|
28 |
print(os.getcwd())
|
29 |
creds_file_name = ".config/gcp_default_credentials.json"
|
30 |
print(creds_file_name)
|
31 |
-
if not
|
32 |
credentials = decode_service_key()
|
33 |
with open(creds_file_name, 'w', encoding='utf-8') as file:
|
34 |
json.dump(credentials, file, ensure_ascii=False, indent=4)
|
|
|
28 |
print(os.getcwd())
|
29 |
creds_file_name = ".config/gcp_default_credentials.json"
|
30 |
print(creds_file_name)
|
31 |
+
if not(os.path.exists(creds_file_name) and os.path.isdir(creds_file_name)):
|
32 |
credentials = decode_service_key()
|
33 |
with open(creds_file_name, 'w', encoding='utf-8') as file:
|
34 |
json.dump(credentials, file, ensure_ascii=False, indent=4)
|