Spaces:
Runtime error
Runtime error
gaspar-avit
commited on
Commit
·
727f9f0
1
Parent(s):
2851008
Upload app.py
Browse files
app.py
CHANGED
@@ -162,6 +162,7 @@ def load_dataset():
|
|
162 |
|
163 |
# Create dataframe
|
164 |
data = pd.read_csv('movies_metadata.csv', low_memory=False)
|
|
|
165 |
|
166 |
return data
|
167 |
|
@@ -230,21 +231,13 @@ def generate_poster(movie_data):
|
|
230 |
|
231 |
import io
|
232 |
from PIL import Image
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
pipeline = load_model()
|
241 |
-
|
242 |
-
# Get image based on synopsis
|
243 |
-
with st.spinner("Generating poster image...\nThis may take some time, please be patient"):
|
244 |
-
poster_image = pipeline(synopsis_sum).images[0]
|
245 |
-
|
246 |
-
st.image(poster_image, caption=movie_data.title)
|
247 |
-
'''
|
248 |
|
249 |
return image
|
250 |
# ------------------------------------------------------- #
|
@@ -302,4 +295,4 @@ if __name__ == "__main__":
|
|
302 |
st.text("")
|
303 |
|
304 |
if image is not None:
|
305 |
-
st.image(image, caption=session.selected_movie.title)
|
|
|
162 |
|
163 |
# Create dataframe
|
164 |
data = pd.read_csv('movies_metadata.csv', low_memory=False)
|
165 |
+
data.drop_duplicates(inplace=True)
|
166 |
|
167 |
return data
|
168 |
|
|
|
231 |
|
232 |
import io
|
233 |
from PIL import Image
|
234 |
+
try:
|
235 |
+
image = Image.open(io.BytesIO(poster_image))
|
236 |
+
st.image(image, caption=movie_data.title.values[0])
|
237 |
+
return image
|
238 |
+
except:
|
239 |
+
st.text(poster_image)
|
240 |
+
return poster_image
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
|
242 |
return image
|
243 |
# ------------------------------------------------------- #
|
|
|
295 |
st.text("")
|
296 |
|
297 |
if image is not None:
|
298 |
+
st.image(image, caption=session.selected_movie.title.values[0])
|