gaspar-avit commited on
Commit
af93059
1 Parent(s): e0d3b95

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -17
app.py CHANGED
@@ -206,15 +206,19 @@ def generate_poster(movie_data):
206
  -return: image of generated alternative poster
207
  """
208
 
209
-
210
  # Get summarization of movie synopsis
211
  st.text("")
212
  with st.spinner("Please wait while the synopsis is being summarized..."):
213
  synopsis_sum = query_summary(movie_data.overview.values[0])
214
 
 
215
  st.text("")
216
- st.subheader("Synopsis:")
217
- st.text("Synopsis summary: " + synopsis_sum)
 
 
 
 
218
  st.text("")
219
 
220
 
@@ -222,7 +226,6 @@ def generate_poster(movie_data):
222
  with st.spinner("Generating poster image..."):
223
  poster_image = query_generate(synopsis_sum)
224
 
225
-
226
  # Show image
227
  try:
228
  image = Image.open(io.BytesIO(poster_image))
@@ -230,21 +233,13 @@ def generate_poster(movie_data):
230
  st.text("")
231
  st.text("")
232
  st.subheader("Resulting poster:")
233
- col1, col2, col3 = st.columns([1, 6, 1])
234
-
235
- with col1:
236
- st.write("")
237
-
238
  with col2:
239
  st.image(image, caption="Movie: \"" + movie_data.title.values[0] + "\"")
240
 
241
- with col3:
242
- st.write("")
243
-
244
  except:
245
  st.text(poster_image)
246
 
247
-
248
  return poster_image
249
  # ------------------------------------------------------- #
250
 
@@ -296,12 +291,12 @@ if __name__ == "__main__":
296
  ## Generate poster
297
  if is_clicked:
298
  poster = generate_poster(data[data.title_year==session.selected_movie])
299
- generate_poster.clear()
300
- st.runtime.legacy_caching.clear_cache()
301
 
302
  ## Clear cache between runs
303
- st.runtime.legacy_caching.clear_cache()
304
- generate_poster.clear()
305
 
306
 
307
  _= """
 
206
  -return: image of generated alternative poster
207
  """
208
 
 
209
  # Get summarization of movie synopsis
210
  st.text("")
211
  with st.spinner("Please wait while the synopsis is being summarized..."):
212
  synopsis_sum = query_summary(movie_data.overview.values[0])
213
 
214
+ # Print summarized synopsis
215
  st.text("")
216
+ synopsis_expander = st.expander("Expand", expanded=True)
217
+ with synopsis_expander:
218
+ st.subheader("Summarized synopsis:")
219
+ col1, col2, col3 = st.columns([1, 5, 1])
220
+ with col2:
221
+ st.text(synopsis_sum)
222
  st.text("")
223
 
224
 
 
226
  with st.spinner("Generating poster image..."):
227
  poster_image = query_generate(synopsis_sum)
228
 
 
229
  # Show image
230
  try:
231
  image = Image.open(io.BytesIO(poster_image))
 
233
  st.text("")
234
  st.text("")
235
  st.subheader("Resulting poster:")
236
+ col1, col2, col3 = st.columns([1, 5, 1])
 
 
 
 
237
  with col2:
238
  st.image(image, caption="Movie: \"" + movie_data.title.values[0] + "\"")
239
 
 
 
 
240
  except:
241
  st.text(poster_image)
242
 
 
243
  return poster_image
244
  # ------------------------------------------------------- #
245
 
 
291
  ## Generate poster
292
  if is_clicked:
293
  poster = generate_poster(data[data.title_year==session.selected_movie])
294
+ #generate_poster.clear()
295
+ #st.runtime.legacy_caching.clear_cache()
296
 
297
  ## Clear cache between runs
298
+ #st.runtime.legacy_caching.clear_cache()
299
+ #generate_poster.clear()
300
 
301
 
302
  _= """