Upload folder using huggingface_hub
Browse files- annotation/src/utils.py +1 -1
- commonsenseConstraint.py +1 -1
- tools/attractions/test.py +4 -4
- tools/flights/apis.py +1 -1
- tools/flights/test.py +4 -4
- tools/googleDistanceMatrix/apis.py +1 -1
- tools/restaurants/apis.py +1 -1
- utils/budget_estimation.py +1 -1
- utils/query_element_selection.py +3 -3
annotation/src/utils.py
CHANGED
|
@@ -146,7 +146,7 @@ def get_city_list(days, deparure_city, destination):
|
|
| 146 |
if days == 3:
|
| 147 |
city_list.append(destination)
|
| 148 |
else:
|
| 149 |
-
city_set = open('
|
| 150 |
state_city_map = {}
|
| 151 |
for unit in city_set:
|
| 152 |
city, state = unit.split('\t')
|
|
|
|
| 146 |
if days == 3:
|
| 147 |
city_list.append(destination)
|
| 148 |
else:
|
| 149 |
+
city_set = open('/home/user/app/database/background/citySet_with_states.txt').read().split('\n')
|
| 150 |
state_city_map = {}
|
| 151 |
for unit in city_set:
|
| 152 |
city, state = unit.split('\t')
|
commonsenseConstraint.py
CHANGED
|
@@ -21,7 +21,7 @@ restaurants = Restaurants()
|
|
| 21 |
googleDistanceMatrix = GoogleDistanceMatrix()
|
| 22 |
attractions = Attractions()
|
| 23 |
|
| 24 |
-
city_state_set = open('
|
| 25 |
city_state_map = {x:y for x,y in [unit.split('\t') for unit in city_state_set]}
|
| 26 |
|
| 27 |
|
|
|
|
| 21 |
googleDistanceMatrix = GoogleDistanceMatrix()
|
| 22 |
attractions = Attractions()
|
| 23 |
|
| 24 |
+
city_state_set = open('/home/user/app/database/background/citySet_with_states.txt','r').read().split('\n')
|
| 25 |
city_state_map = {x:y for x,y in [unit.split('\t') for unit in city_state_set]}
|
| 26 |
|
| 27 |
|
tools/attractions/test.py
CHANGED
|
@@ -4,14 +4,14 @@ import sys
|
|
| 4 |
import os
|
| 5 |
sys.path.append(os.path.abspath(os.path.join(os.getcwd(), "..")))
|
| 6 |
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
| 7 |
-
unique_cities = Attractions(path="
|
| 8 |
-
df = Attractions(path="
|
| 9 |
print(len(df))
|
| 10 |
-
citySet = open('
|
| 11 |
cnt = 0
|
| 12 |
for city in unique_cities:
|
| 13 |
if city not in citySet:
|
| 14 |
df = df[df['City'] != city]
|
| 15 |
print(len(df))
|
| 16 |
|
| 17 |
-
df.to_csv('
|
|
|
|
| 4 |
import os
|
| 5 |
sys.path.append(os.path.abspath(os.path.join(os.getcwd(), "..")))
|
| 6 |
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
| 7 |
+
unique_cities = Attractions(path="..//home/user/app/database/attractions/attractions.csv").data['City'].unique()
|
| 8 |
+
df = Attractions(path="..//home/user/app/database/attractions/attractions.csv").data
|
| 9 |
print(len(df))
|
| 10 |
+
citySet = open('..//home/user/app/database/background/citySet.txt','r').read().split('\n')
|
| 11 |
cnt = 0
|
| 12 |
for city in unique_cities:
|
| 13 |
if city not in citySet:
|
| 14 |
df = df[df['City'] != city]
|
| 15 |
print(len(df))
|
| 16 |
|
| 17 |
+
df.to_csv('..//home/user/app/database/attractions/attractions2.csv', index=False)
|
tools/flights/apis.py
CHANGED
|
@@ -5,7 +5,7 @@ from annotation.src.utils import extract_before_parenthesis
|
|
| 5 |
|
| 6 |
class Flights:
|
| 7 |
|
| 8 |
-
def __init__(self, path="
|
| 9 |
self.path = path
|
| 10 |
self.data = None
|
| 11 |
|
|
|
|
| 5 |
|
| 6 |
class Flights:
|
| 7 |
|
| 8 |
+
def __init__(self, path="/home/user/app/database/flights/clean_Flights_2022.csv"):
|
| 9 |
self.path = path
|
| 10 |
self.data = None
|
| 11 |
|
tools/flights/test.py
CHANGED
|
@@ -18,12 +18,12 @@ import os
|
|
| 18 |
# results = results[results["DestCityName"] == destination]
|
| 19 |
sys.path.append(os.path.abspath(os.path.join(os.getcwd(), "..")))
|
| 20 |
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
| 21 |
-
unique_cities = list(Flights(path="
|
| 22 |
-
df = Flights(path="
|
| 23 |
|
| 24 |
print(len(df))
|
| 25 |
|
| 26 |
-
citySet = open('
|
| 27 |
cnt = 0
|
| 28 |
|
| 29 |
for city in unique_cities:
|
|
@@ -32,4 +32,4 @@ for city in unique_cities:
|
|
| 32 |
|
| 33 |
print(len(df))
|
| 34 |
|
| 35 |
-
df.to_csv('
|
|
|
|
| 18 |
# results = results[results["DestCityName"] == destination]
|
| 19 |
sys.path.append(os.path.abspath(os.path.join(os.getcwd(), "..")))
|
| 20 |
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
| 21 |
+
unique_cities = list(Flights(path="..//home/user/app/database/flights/clean_Flights_2022.csv").data['OriginCityName'].unique()) + list(Flights(path="..//home/user/app/database/flights/clean_Flights_2022.csv").data['DestCityName'].unique())
|
| 22 |
+
df = Flights(path="..//home/user/app/database/flights/clean_Flights_2022.csv").data
|
| 23 |
|
| 24 |
print(len(df))
|
| 25 |
|
| 26 |
+
citySet = open('..//home/user/app/database/background/citySet.txt','r').read().split('\n')
|
| 27 |
cnt = 0
|
| 28 |
|
| 29 |
for city in unique_cities:
|
|
|
|
| 32 |
|
| 33 |
print(len(df))
|
| 34 |
|
| 35 |
+
df.to_csv('..//home/user/app/database/flights/clean_Flights_2022.csv', index=False)
|
tools/googleDistanceMatrix/apis.py
CHANGED
|
@@ -14,7 +14,7 @@ os.environ["https_proxy"] = "http://127.0.0.1:7890"
|
|
| 14 |
class GoogleDistanceMatrix:
|
| 15 |
def __init__(self, subscription_key: str="AIzaSyClbhCKqk2QS97jadE0RQ3qYCAteY7sK4I") -> None:
|
| 16 |
self.gplaces_api_key: str = subscription_key
|
| 17 |
-
self.data = pd.read_csv('
|
| 18 |
print("GoogleDistanceMatrix loaded.")
|
| 19 |
|
| 20 |
def run(self, origin, destination, mode='driving'):
|
|
|
|
| 14 |
class GoogleDistanceMatrix:
|
| 15 |
def __init__(self, subscription_key: str="AIzaSyClbhCKqk2QS97jadE0RQ3qYCAteY7sK4I") -> None:
|
| 16 |
self.gplaces_api_key: str = subscription_key
|
| 17 |
+
self.data = pd.read_csv('/home/user/app/database/googleDistanceMatrix/distance.csv')
|
| 18 |
print("GoogleDistanceMatrix loaded.")
|
| 19 |
|
| 20 |
def run(self, origin, destination, mode='driving'):
|
tools/restaurants/apis.py
CHANGED
|
@@ -4,7 +4,7 @@ from typing import Optional
|
|
| 4 |
from annotation.src.utils import extract_before_parenthesis
|
| 5 |
|
| 6 |
class Restaurants:
|
| 7 |
-
def __init__(self, path="
|
| 8 |
self.path = path
|
| 9 |
self.data = pd.read_csv(self.path).dropna()[['Name','Average Cost','Cuisines','Aggregate Rating','City']]
|
| 10 |
print("Restaurants loaded.")
|
|
|
|
| 4 |
from annotation.src.utils import extract_before_parenthesis
|
| 5 |
|
| 6 |
class Restaurants:
|
| 7 |
+
def __init__(self, path="/home/user/app/database/restaurants/clean_restaurant_2022.csv"):
|
| 8 |
self.path = path
|
| 9 |
self.data = pd.read_csv(self.path).dropna()[['Name','Average Cost','Cuisines','Aggregate Rating','City']]
|
| 10 |
print("Restaurants loaded.")
|
utils/budget_estimation.py
CHANGED
|
@@ -56,7 +56,7 @@ def budget_calc(org, dest, days, date:list , people_number=None, local_constrain
|
|
| 56 |
|
| 57 |
|
| 58 |
elif grain == "state":
|
| 59 |
-
city_set = open('
|
| 60 |
|
| 61 |
all_hotel_data = []
|
| 62 |
all_restaurant_data = []
|
|
|
|
| 56 |
|
| 57 |
|
| 58 |
elif grain == "state":
|
| 59 |
+
city_set = open('/home/user/app/database/background/citySet_with_states.txt').read().strip().split('\n')
|
| 60 |
|
| 61 |
all_hotel_data = []
|
| 62 |
all_restaurant_data = []
|
utils/query_element_selection.py
CHANGED
|
@@ -11,7 +11,7 @@ import numpy as np
|
|
| 11 |
|
| 12 |
google_distance = GoogleDistanceMatrix()
|
| 13 |
|
| 14 |
-
city_set = open('
|
| 15 |
|
| 16 |
state_city_map = {}
|
| 17 |
|
|
@@ -49,7 +49,7 @@ def select_consecutive_dates(num_days, start_date=datetime(2022, 3, 1), end_date
|
|
| 49 |
|
| 50 |
def get_org_dest(days:int):
|
| 51 |
if days == 3:
|
| 52 |
-
city_set = open('
|
| 53 |
|
| 54 |
org = random.choice(city_set)
|
| 55 |
|
|
@@ -63,7 +63,7 @@ def get_org_dest(days:int):
|
|
| 63 |
|
| 64 |
elif days in [5,7]:
|
| 65 |
|
| 66 |
-
state_set = open('
|
| 67 |
org = random.choice(state_set)
|
| 68 |
|
| 69 |
while True:
|
|
|
|
| 11 |
|
| 12 |
google_distance = GoogleDistanceMatrix()
|
| 13 |
|
| 14 |
+
city_set = open('/home/user/app/database/background/citySet_with_states.txt').read().strip().split('\n')
|
| 15 |
|
| 16 |
state_city_map = {}
|
| 17 |
|
|
|
|
| 49 |
|
| 50 |
def get_org_dest(days:int):
|
| 51 |
if days == 3:
|
| 52 |
+
city_set = open('/home/user/app/database/background/citySet_with_states.txt').read().strip().split('\n')
|
| 53 |
|
| 54 |
org = random.choice(city_set)
|
| 55 |
|
|
|
|
| 63 |
|
| 64 |
elif days in [5,7]:
|
| 65 |
|
| 66 |
+
state_set = open('/home/user/app/database/background/citySet_with_states.txt').read().strip().split('\n')
|
| 67 |
org = random.choice(state_set)
|
| 68 |
|
| 69 |
while True:
|