Spaces:
Runtime error
Runtime error
gaspar-avit
commited on
Commit
·
e9a814d
1
Parent(s):
43a2075
Upload app.py
Browse files
app.py
CHANGED
@@ -122,6 +122,18 @@ def authenticate_kaggle():
|
|
122 |
api.authenticate()
|
123 |
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
@st.experimental_memo(persist=True, show_spinner=False, suppress_st_warning=True, max_entries=1)
|
126 |
def load_dataset():
|
127 |
"""
|
@@ -152,8 +164,8 @@ def load_dataset():
|
|
152 |
|
153 |
# Create dataframe
|
154 |
data = pd.read_csv('movies.csv', low_memory=False)
|
155 |
-
data['year'] = data[
|
156 |
-
data['
|
157 |
|
158 |
return data
|
159 |
|
@@ -294,7 +306,7 @@ if __name__ == "__main__":
|
|
294 |
st.text("")
|
295 |
|
296 |
## Select box with all the movies as choices
|
297 |
-
session.selected_movie = st.selectbox(label="Select a movie to generate alternative poster", options=data.
|
298 |
|
299 |
st.text("")
|
300 |
st.text("")
|
@@ -305,7 +317,7 @@ if __name__ == "__main__":
|
|
305 |
|
306 |
## Generate poster
|
307 |
if is_clicked:
|
308 |
-
poster = generate_poster(data[data.
|
309 |
#generate_poster.clear()
|
310 |
#st.runtime.legacy_caching.clear_cache()
|
311 |
|
@@ -321,6 +333,6 @@ if __name__ == "__main__":
|
|
321 |
is_clicked_rerun = col1.button(label="Rerun with same movie!")
|
322 |
|
323 |
if is_clicked_rerun:
|
324 |
-
poster = generate_poster(data[data.
|
325 |
"""
|
326 |
|
|
|
122 |
api.authenticate()
|
123 |
|
124 |
|
125 |
+
def map_year(x):
|
126 |
+
a = ''
|
127 |
+
if isinstance(x, str):
|
128 |
+
try:
|
129 |
+
a = re.search('\(([0-9_]+)\)', x[-7:]).group(1)
|
130 |
+
except:
|
131 |
+
a = '0'
|
132 |
+
else:
|
133 |
+
a = '0'
|
134 |
+
return a
|
135 |
+
|
136 |
+
|
137 |
@st.experimental_memo(persist=True, show_spinner=False, suppress_st_warning=True, max_entries=1)
|
138 |
def load_dataset():
|
139 |
"""
|
|
|
164 |
|
165 |
# Create dataframe
|
166 |
data = pd.read_csv('movies.csv', low_memory=False)
|
167 |
+
#data['year'] = data['release_date'].map(lambda x: x.split('-')[0] if isinstance(x, str) else '0')
|
168 |
+
data['year'] = data['title'].map(map_year)
|
169 |
|
170 |
return data
|
171 |
|
|
|
306 |
st.text("")
|
307 |
|
308 |
## Select box with all the movies as choices
|
309 |
+
session.selected_movie = st.selectbox(label="Select a movie to generate alternative poster", options=data.title)
|
310 |
|
311 |
st.text("")
|
312 |
st.text("")
|
|
|
317 |
|
318 |
## Generate poster
|
319 |
if is_clicked:
|
320 |
+
poster = generate_poster(data[data.title==session.selected_movie])
|
321 |
#generate_poster.clear()
|
322 |
#st.runtime.legacy_caching.clear_cache()
|
323 |
|
|
|
333 |
is_clicked_rerun = col1.button(label="Rerun with same movie!")
|
334 |
|
335 |
if is_clicked_rerun:
|
336 |
+
poster = generate_poster(data[data.title==selected_movie])
|
337 |
"""
|
338 |
|