Spaces:
Runtime error
Runtime error
gaspar-avit
commited on
Commit
·
225a832
1
Parent(s):
fc29cf5
Upload app.py
Browse files
app.py
CHANGED
@@ -139,8 +139,18 @@ def load_dataset():
|
|
139 |
-return: dataframe containing dataset
|
140 |
"""
|
141 |
|
142 |
-
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
# Downloading Movies dataset
|
146 |
api.dataset_download_file('rounakbanik/the-movies-dataset', 'movies_metadata.csv')
|
|
|
139 |
-return: dataframe containing dataset
|
140 |
"""
|
141 |
|
142 |
+
## --- Connect to kaggle API --- ##
|
143 |
+
# Save credentials to json file
|
144 |
+
if not os.path.exists(PATH_JSON):
|
145 |
+
api_token = {"username":st.secrets['username'],"key":st.secrets['key']}
|
146 |
+
with open(PATH_JSON, 'w') as file:
|
147 |
+
json.dump(api_token, file)
|
148 |
+
|
149 |
+
# Activate Kaggle API
|
150 |
+
global api
|
151 |
+
api = KaggleApi()
|
152 |
+
api.authenticate()
|
153 |
+
## ----------------------------- ##
|
154 |
|
155 |
# Downloading Movies dataset
|
156 |
api.dataset_download_file('rounakbanik/the-movies-dataset', 'movies_metadata.csv')
|