Spaces:
Sleeping
Sleeping
Download src/read_data.py from vchandraiitk/Thugs_Of_AI: direct link, hf CLI and curl.
- Browser
- Download file 902 Bytes
-
https://huggingface.co/spaces/vchandraiitk/Thugs_Of_AI/resolve/main/src/read_data.py
- Command line
-
hf download hf://spaces/vchandraiitk/Thugs_Of_AI/src/read_data.py
-
curl -L -o read_data.py https://huggingface.co/spaces/vchandraiitk/Thugs_Of_AI/resolve/main/src/read_data.py
902 Bytes
| import os | |
| import pandas as pd | |
| import sys | |
| cust_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data", "customer_profile.csv") | |
| org_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data", "organization_Profile.csv") | |
| def get_customer_details(customer_id): | |
| df = pd.read_csv(cust_path) | |
| customer_row = df[df["Customer_Id"] == customer_id] | |
| if customer_row.empty: | |
| df = pd.read_csv(org_path) | |
| customer_row = df[df["Customer_Id"] == customer_id] | |
| if customer_row.empty: | |
| return None, None | |
| customer_dict = customer_row.iloc[0].to_dict() | |
| return customer_row, customer_dict | |
| if __name__ == "__main__": | |
| if len(sys.argv) > 1: | |
| input_text = sys.argv[1] | |
| score = get_customer_details(input_text) | |
| print(score) # <-- print this so the shell can capture it | |
| else: | |
| print("No input text provided.") | |